If I understand SERIAL type correctly, it is auto-incremented if no value is specified for every INSERT statement. I was wondering if I can have auto-increment applied once per group of INSERTs or even per transactions.
E.g. If I do 3 inserts committing after each one I get 1,2,3 in the SERIAL column. I wanted to create single transaction that has 3 inserts and increment the row affected rows, ending up with 1,1,1 in the SERIAL column for those rows. If I were to do this again, I would get 2,2,2 not 4,5,6
nextval()at the start of your transaction and then usecurrval()in all inserts during that transaction.