Skip to content

fix: scope pg catalog metadata to selected catalog#679

Merged
EDsCODE merged 2 commits into
mainfrom
fix/iceberg-pg-catalog-leak
Jun 4, 2026
Merged

fix: scope pg catalog metadata to selected catalog#679
EDsCODE merged 2 commits into
mainfrom
fix/iceberg-pg-catalog-leak

Conversation

@EDsCODE
Copy link
Copy Markdown
Contributor

@EDsCODE EDsCODE commented Jun 4, 2026

Summary

  • Add session-scoped pg_class_full, pg_namespace, and pg_attribute views filtered by current_database() so Iceberg sessions do not discover DuckLake schemas/tables/columns.
  • Stop shared-worker activation from installing DuckLake-only global pg catalog views on dual-catalog workers.
  • Trigger Iceberg column metadata loading for pg_attribute discovery and support Hex/JDBC predicates like n.nspname and c.relname.

Test Plan

  • go test ./server ./server/icebergmeta -count=1
  • GOCACHE=/private/tmp/duckgres-gocache GOLANGCI_LINT_CACHE=/private/tmp/duckgres-golangci-cache PATH=/private/tmp/duckgres-golangci:$PATH just lint

EDsCODE and others added 2 commits June 4, 2026 11:02
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>
@EDsCODE EDsCODE marked this pull request as ready for review June 4, 2026 18:56
@EDsCODE EDsCODE merged commit 03ee5f7 into main Jun 4, 2026
24 checks passed
@EDsCODE EDsCODE deleted the fix/iceberg-pg-catalog-leak branch June 4, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant