You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Row pre-fills NULL for PostgreSQL identity columns (GENERATED ALWAYS AS IDENTITY); Set Value has no "Default" option #2588
CREATETABLEbank_lookup (
id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
...
);
Add Row (⌘⇧N): the id cell shows NULL.
Right-click the id cell → Set Value: only "Empty" is offered — no "Default".
Columns with an explicit default (including DEFAULT NULL) correctly pre-fill as DEFAULT.
Saving sends the id as NULL and fails:
ERROR: cannot insert a non-DEFAULT value into column "id"
DETAIL: Column "id" is an identity column defined as GENERATED ALWAYS.
Why (likely)
PostgreSQL reports identity columns with column_default = NULL — the generation lives in attidentity (information_schema is_identity/identity_generation), not in pg_attrdef. If the Add Row pre-fill and Set Value menu key off the column default only, identity columns fall through as "no default". The driver protocol's ColumnMetadata.identityKind (ALWAYS / BY DEFAULT) already carries this information.
Expected
Identity columns should pre-fill DEFAULT on Add Row and offer "Default" in Set Value. The plumbing exists: Duplicate Row already resets the PK to DEFAULT, and SQLStatementGenerator omits __DEFAULT__ columns from INSERTs — an identity column marked with that sentinel would produce the correct INSERT INTO t (cols…) VALUES (…) with the id column omitted.
Workaround
Duplicate Row (⌘⇧D) on an existing row — its PK is reset to DEFAULT — then edit cells and save.
Activity