serial pseudo-type lacks sequence ownership and permissions enforcement
warningconfigurationUpdated Mar 4, 2026
Technologies:
How to detect:
serial and bigserial pseudo-types create a sequence but the sequence is not truly 'owned' by the column in a way that prevents other tables from using it. Permissions on the sequence must be managed separately. serial does not prevent manual inserts of arbitrary values, which can cause sequence conflicts. Not SQL standard compliant.
Recommended action:
Use identity columns (introduced in PostgreSQL 10): CREATE TABLE users (id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY). GENERATED ALWAYS ties sequence tightly to column, prevents manual insertion by default (use OVERRIDING SYSTEM VALUE to bypass), and follows SQL standard. Use GENERATED BY DEFAULT to allow occasional manual inserts.