For example, a fictional writer may insert into reporting.export_jobs. The id column's default explicitly invokes nextval on reporting.export_jobs_id_seq. After inspecting the default, an operator can query the role’s sequence privileges without advancing the sequence.
SELECT has_sequence_privilege('export_writer',
'reporting.export_jobs_id_seq', 'USAGE') AS usage,
has_sequence_privilege('export_writer',
'reporting.export_jobs_id_seq', 'UPDATE') AS can_update;
Either privilege suffices for nextval. If both are false and the default is the source of the error, review USAGE on the one sequence with its owner. Avoid calling nextval as a diagnostic. It advances the sequence and PostgreSQL does not reclaim the value on transaction rollback. Sequence manipulation functions · Privilege inquiry functions