fix: match native column types in scoped pg_tables/pg_views/pg_sequences views#683
Draft
EDsCODE wants to merge 1 commit into
Draft
fix: match native column types in scoped pg_tables/pg_views/pg_sequences views#683EDsCODE wants to merge 1 commit into
EDsCODE wants to merge 1 commit into
Conversation
…ces views The session-scoped pg_tables/pg_views/pg_sequences compat views (added in the catalog-separation work) replace DuckDB's native pg_catalog views in client queries. Their synthesized columns must match the native column types exactly so the only behavior change is the catalog row-filter, not the result shape. DuckDB's native pg_tables.tablespace and pg_sequences.data_type/cache_size are INTEGER (not text/bigint). A bare `NULL AS tablespace` types as INT32 which happened to match, but `'bigint' AS data_type` (VARCHAR) and other nulls diverged, so a client filtering e.g. `WHERE tablespace = 'x'` could hit a type error it would not have hit against the native view. Pin the synthesized columns to native types (tablespace/data_type/ cache_size -> INTEGER, value columns -> BIGINT) and add TestPgCatalogConvenienceViewsMatchNativeShape, which DESCRIBEs each compat view and asserts its (column_name, column_type) list is identical to the native pg_catalog view. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Follow-up to the iceberg/ducklake catalog-separation work (PR #679, now on main). The session-scoped
pg_tables/pg_views/pg_sequencescompat views replace DuckDB's nativepg_catalogviews in client queries, so their synthesized columns must match the native column types exactly — the only intended behavior change is thecurrent_database()row-filter, not the result shape.While verifying separation on the prod cluster I observed that
pg_tableswas correctly routed tomemory.main.pg_tables(the scoping works), but a probe query trippedCould not convert string 'NULL' to INT32— the synthesized columns had drifted from native types.DuckDB's native types are:
pg_tables.tablespace→INTEGERpg_sequences.data_type→INTEGER(not a'bigint'string)pg_sequences.cache_size→INTEGERBIGINTChanges
tablespace/data_type/cache_size→INTEGER, value columns →BIGINT).TestPgCatalogConvenienceViewsMatchNativeShape:DESCRIBEs each compat view and asserts its(column_name, column_type)list is byte-for-byte identical to the nativepg_catalogview.Test plan
go test ./server -run 'TestPgCatalogConvenienceViewsMatchNativeShape|TestPgTablesViewsSequencesOnlyExposeSelectedCatalog' -count=1go build ./...,gofmt,golangci-lintclean🤖 Generated with Claude Code