Tino Wildenhain wrote:
since your insert above would call nextval() per default, its save to use currval() in the same transaction.
Ah, I didn't realize currval() was handled session-local - that removes my need to support any non-default value to my serial column. So, if I can identify use of a non-default value via a trigger, that solves my first problem. I'll try writing such a trigger tomorrow.
That leaves only preventing use of setval() as a problem. If I revoke UPDATE, it also blocks the use of nextval() by the default value for the serial column on INSERT.