Skip to content

Show the user objects in the catalog tables - #178

Merged
tamnd merged 1 commit into
mainfrom
m2-catalog-rows
Oct 8, 2026
Merged

tamnd merged 1 commit into
mainfrom
m2-catalog-rows

Conversation

@tamnd

@tamnd tamnd commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Part of #3.

The catalog tables now show the objects that a user makes. Before this change pg_class and the other catalogs showed only the built-in rows, so a client could not see a new schema, table, index or sequence.

What changes

  • A scan of pg_namespace, pg_class, pg_type, pg_attribute, pg_attrdef, pg_constraint, pg_index, pg_sequence and pg_depend adds the rows of the session catalog after the built-in rows. The new module rupg-exec/src/user.rs makes these rows. The Session trait of rupg-func gives the catalog to the executor.
  • CREATE TABLE now makes the TOAST table pg_toast.pg_toast_N and its index, with the same OIDs, columns, operator classes and pg_depend rows as PostgreSQL. The TOAST table holds no data.
  • pg_class has relhastriggers and reltoastrelid. A foreign key sets relhastriggers on the two tables. It does not make the triggers yet, so pg_trigger has no rows for them.
  • The columns of a sequence are not null, and a unique, primary key or foreign key constraint has connoinherit set, as in PostgreSQL. An index column copies attndims from its table column.
  • CREATE INDEX on a TOAST table gives 42501, and a foreign key to a TOAST table gives 42809, with the messages of PostgreSQL.
  • xid and cid have text input. xideqint4 and xidneqint4 work, so relfrozenxid = 0 works.

The columns of type pg_node_tree (adbin, conbin, indexprs and indpred) hold the analyzer form of the expression, not the PostgreSQL node text. pg_get_expr and the other deparse functions come in the next PR.

Test

  • The new session test makes a schema, two tables with a serial column, a check, a default, a foreign key, an array column and an index on an expression with a predicate. Then it reads the nine catalogs. The expected rows come from the PostgreSQL 19 oracle for the same statements, with the OIDs moved to start at 16384. The pg_node_tree columns are compared as IS NOT NULL, and pg_depend leaves out the rows of the foreign key triggers.
  • A new executor test checks that each value of a user row has the kind of its column type, and that a not null column has no NULL.
  • The catalog test checks the TOAST table, its index and its pg_depend rows.
  • The xid comparisons in the executor test use the results of the oracle.
  • srvtest passed on server1.

@tamnd tamnd added this to the M2: Connect and introspect milestone Oct 8, 2026
@tamnd tamnd added kind/feature It does not do something that it must do. area/session Sessions, settings, pooling and the server runtime. area/catalog The catalog, pg_catalog, information_schema and the statistics views. labels Oct 8, 2026
@tamnd tamnd self-assigned this Oct 8, 2026
@tamnd
tamnd merged commit b758524 into main Oct 8, 2026
5 checks passed
@tamnd
tamnd deleted the m2-catalog-rows branch October 8, 2026 15:22
This was referenced Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/catalog The catalog, pg_catalog, information_schema and the statistics views. area/session Sessions, settings, pooling and the server runtime. kind/feature It does not do something that it must do.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant