Skip to content

Commit 4567e39

Browse files
EDsCODEclaude
andauthored
fix: redirect catalog-qualified information_schema to compat views (#383)
Queries like `ducklake.information_schema.columns` were bypassing the compat view redirect because the transform skipped references with an explicit `ducklake` catalog prefix. This caused failures for tools that qualify information_schema queries with the catalog name. The compat views use unqualified `information_schema` internally, which resolves to the default catalog at query time, so redirecting catalog-qualified references does not cause recursion. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4ddec34 commit 4567e39

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

transpiler/transform/information_schema.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ func (t *InformationSchemaTransform) walkAndTransform(node *pg_query.Node, chang
6161
switch n := node.Node.(type) {
6262
case *pg_query.Node_RangeVar:
6363
// Table references: information_schema.columns -> memory.main.information_schema_columns_compat
64-
// Views are created in the memory.main schema so they're always accessible regardless of default catalog
65-
// Skip transformation if catalog is explicitly "ducklake" - those are queries from
66-
// within the compat views that need to access the actual DuckLake information_schema
67-
if n.RangeVar != nil && strings.EqualFold(n.RangeVar.Schemaname, "information_schema") &&
68-
!strings.EqualFold(n.RangeVar.Catalogname, "ducklake") {
64+
// Views are created in the memory.main schema so they're always accessible regardless of default catalog.
65+
// Redirect all information_schema references, including catalog-qualified ones like
66+
// ducklake.information_schema.columns. The compat views themselves use unqualified
67+
// information_schema which resolves at query time to the default catalog, so no
68+
// recursion occurs.
69+
if n.RangeVar != nil && strings.EqualFold(n.RangeVar.Schemaname, "information_schema") {
6970
relname := strings.ToLower(n.RangeVar.Relname)
7071
if newName, ok := t.ViewMappings[relname]; ok {
7172
n.RangeVar.Relname = newName

0 commit comments

Comments
 (0)