fix: scope pg catalog metadata to selected catalog#679
Merged
Conversation
Follow-up to the pg_catalog scoping work, fixing three seam gaps the session-scoped compat views did not cover: 1. pg_tables / pg_views / pg_sequences leaked the other catalog's object names: they were absent from the transpiler ViewMappings, so they fell through to DuckDB's native cross-catalog pg_catalog views (which ignore current_database()). On a dual-attached worker an Iceberg session saw DuckLake tables/views/sequences and vice versa. Added session-scoped compat views filtered by current_database(), the three ViewMappings entries, and PG_TABLES/PG_VIEWS/PG_SEQUENCES detection in Classify() so the queries actually route through transpilation instead of passing through as Direct. 2. Iceberg sessions were left in the ephemeral `memory` catalog while current_database() reported 'iceberg', so unqualified DDL/DML silently missed the warehouse. InitSessionDatabaseMetadata's defer only restores the catalog for DuckLake. Fixed both callers: standalone (server/conn.go now issues USE iceberg.<schema> after init) and the control plane (effectiveSessionDefaultCommand now issues the Iceberg USE even when the client supplied a search_path). 3. The Iceberg column-metadata load fired for DuckLake sessions of dual-catalog orgs (Lakekeeper REST calls + churn on the shared metadata table they can never read). shouldLoadIcebergColumnMetadata now gates on the session's resolved physical catalog being iceberg. 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
pg_class_full,pg_namespace, andpg_attributeviews filtered bycurrent_database()so Iceberg sessions do not discover DuckLake schemas/tables/columns.pg_attributediscovery and support Hex/JDBC predicates liken.nspnameandc.relname.Test Plan
go test ./server ./server/icebergmeta -count=1GOCACHE=/private/tmp/duckgres-gocache GOLANGCI_LINT_CACHE=/private/tmp/duckgres-golangci-cache PATH=/private/tmp/duckgres-golangci:$PATH just lint