Repository navigation
catalog: add pg_class.relpages and pg_am.amcanorder for pgjdbc getIndexInfo - #39720
Merged
Merged
Conversation
sjwiesman
force-pushed
the
pgjdbc-get-index-info
branch
from
October 11, 2026 20:08
80fdedb to
1e4abf6
Compare
…exInfo pgjdbc's DatabaseMetaData.getIndexInfo selects pg_class.relpages and, because Materialize reports server_version 9.5, the pre-9.6 column pg_am.amcanorder. Both were missing, so the call failed with "column does not exist". The AWS Glue Data Catalog JDBC crawler calls getIndexInfo for every table and view it registers, so a crawl against Materialize aborted on the first object. relpages reports 0, which is what PostgreSQL reports for a relation that has never been vacuumed or analyzed and matches the existing reltuples = -1. pg_am has no rows, so amcanorder only adds a column and reports nothing about Materialize indexes. getIndexInfo now succeeds and returns no rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GaoLYNnyZ2j3BJsTDD59uH
sjwiesman
force-pushed
the
pgjdbc-get-index-info
branch
from
October 11, 2026 22:03
1e4abf6 to
b31c1b3
Compare
ggevay
self-requested a review
October 12, 2026 11:54
pgjdbc's getIndexInfo query selects pg_class.relpages and, below server version 9.6, pg_am.amcanorder. Without those columns the call fails with `column "ci.relpages" does not exist`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The file lists every builtin column name, per the generator query in its header, and pg_am.amcanorder is a new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ggevay
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
pgjdbc's
DatabaseMetaData.getIndexInfofails against Materialize withcolumn "ci.relpages" does not exist. Once that's fixed it fails again onam.amcanorder. It readsamcanorderbecause Materialize reportsserver_version9.5, and pgjdbc's pre-9.6 path still selects that column. Postgres removed it in 9.6.The AWS Glue Data Catalog JDBC crawler calls
getIndexInfofor every table and view it registers, so a crawl against Materialize aborts on the first object. I checked this end to end with a real Glue crawler in a scratch AWS account. Stock Materialize fails the crawl. With this change, tables, sources and views register with their column types and comments, matching a Postgres 16 control crawled the same way.Changes
pg_class.relpages: newint4column, always0. That's what Postgres reports for a relation that has never been vacuumed or analyzed, and it matches the existingreltuples = -1.pg_am.amcanorder: newboolcolumn on a view that still has no rows. It adds a column and reports nothing about Materialize indexes.getIndexInfonow succeeds and returns no rows, because it inner-joins on the emptypg_am. Populatingpg_amwould mean labeling arrangements as a Postgres access method likebtree, so it's out of scope here.Tests
pg_catalog_class.sltassertsrelpages.test/testdrive/pg-catalog.tdlists the newpg_classcolumn.catalog_server_explain.sltandmz_catalog_server_index_accounting.sltwere regenerated. Every diff is either a shifted column number or two extra rows in a builtin-catalog constant.relpagesis added to the workload-replay identifier allowlist.Release notes
This release will let the AWS Glue Data Catalog JDBC crawler, and other pgjdbc clients that call
DatabaseMetaData.getIndexInfo, read metadata from Materialize. It addspg_class.relpagesandpg_am.amcanorder.🤖 Generated with Claude Code
https://claude.ai/code/session_01GaoLYNnyZ2j3BJsTDD59uH