Select multiple ids from a PostgreSQL sequence
select nextval(‘mytable_seq’) from generate_series(1,3); generate_series is a function which returns many rows with sequential numbers, configured by it’s arguments. In above example, we don’t care about the value in each row, we just use generate_series as row generator. And for each row we can call nextval. In this case it returns 3 numbers (nextvals). You … Read more