EXPLAIN VERBOSE fails on INSERT into an IDENTITY column table: T_NextValueExpr deparse arm unported
pgrust version: 0.2 (binary pgrust-0.2-linux-x86_64, PostgreSQL 18 compatible)
Component: ruleutils.c / get_rule_expr() deparse of T_NextValueExpr
Summary
EXPLAIN VERBOSE (with or without ANALYZE) errors out on any INSERT targeting a table with a GENERATED ALWAYS AS IDENTITY column, when the identity column is not listed in the INSERT's target list. PostgreSQL emits a T_NextValueExpr in the plan for the identity default and the pgrust deparse path for that node type is not ported (arm unported).
Reproducer
CREATE TABLE t (id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, v int);
EXPLAIN (VERBOSE) INSERT INTO t (v) VALUES (1);
Note: serial columns are NOT affected (deparse via DEFAULT nextval works); only GENERATED AS IDENTITY triggers the unported code path.
Expected behaviour
A normal query plan like PostgreSQL 18.6 produces, e.g.:
Insert on t_identity (cost=0.00..0.01 rows=0 width=0)
-> Result (cost=0.00..0.01 rows=1 width=8)
Output: nextval('t_identity_id_seq'::regclass), 1
Actual behaviour
ERROR: ruleutils (get_rule_expr): T_NextValueExpr deparse arm unported
Workaround: re-run the EXPLAIN without VERBOSE (the plan prints, but the Output: line and any identity nextval expression are dropped from the output).
Notes
- Triggered regardless of
ANALYZE/BUFFERS — VERBOSE alone is sufficient.
- Affects every table with a
GENERATED ALWAYS AS IDENTITY pk column (8/9 tables in the benchmark schema use it).
EXPLAIN VERBOSE fails on INSERT into an IDENTITY column table:
T_NextValueExpr deparse arm unportedpgrust version: 0.2 (binary
pgrust-0.2-linux-x86_64, PostgreSQL 18 compatible)Component:
ruleutils.c/get_rule_expr()deparse ofT_NextValueExprSummary
EXPLAIN VERBOSE(with or withoutANALYZE) errors out on anyINSERTtargeting a table with aGENERATED ALWAYS AS IDENTITYcolumn, when the identity column is not listed in the INSERT's target list. PostgreSQL emits aT_NextValueExprin the plan for the identity default and the pgrust deparse path for that node type is not ported (arm unported).Reproducer
Note:
serialcolumns are NOT affected (deparse via DEFAULT nextval works); onlyGENERATED AS IDENTITYtriggers the unported code path.Expected behaviour
A normal query plan like PostgreSQL 18.6 produces, e.g.:
Actual behaviour
Workaround: re-run the EXPLAIN without
VERBOSE(the plan prints, but theOutput:line and any identitynextvalexpression are dropped from the output).Notes
ANALYZE/BUFFERS—VERBOSEalone is sufficient.GENERATED ALWAYS AS IDENTITYpk column (8/9 tables in the benchmark schema use it).