Skip to content

EXPLAIN VERBOSE fails on INSERT into an IDENTITY column table: T_NextValueExpr deparse arm unported #111

Description

@lrweck

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/BUFFERSVERBOSE alone is sufficient.
  • Affects every table with a GENERATED ALWAYS AS IDENTITY pk column (8/9 tables in the benchmark schema use it).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions