Skip to content

Conversation

@EDsCODE
Copy link
Contributor

@EDsCODE EDsCODE commented Dec 19, 2025

Summary

  • Fixes queries against information_schema.columns returning VARCHAR instead of text for string columns
  • PostgreSQL clients expect text or character varying, but DuckDB returns VARCHAR

Changes

  1. Transpiler transform (transpiler/transform/pgcatalog.go): Rewrite information_schema.columnsinformation_schema_columns_compat
  2. Fix missing call (server/server.go): initInformationSchema() was never called - now called during connection setup
  3. Add test (transpiler/transpiler_test.go): Verify the rewrite works correctly

How it works

The information_schema_columns_compat view (created in catalog.go) wraps DuckDB's native information_schema.columns and converts the data_type column:

CASE
    WHEN UPPER(data_type) = 'VARCHAR' OR UPPER(data_type) LIKE 'VARCHAR(%' THEN 'text'
    ELSE data_type
END AS data_type

The transpiler now rewrites queries from:

SELECT data_type FROM information_schema.columns WHERE table_name = 'foo'

To:

SELECT data_type FROM information_schema_columns_compat WHERE table_name = 'foo'

Test plan

  • Build succeeds
  • All tests pass
  • New test verifies the rewrite

🤖 Generated with Claude Code

EDsCODE and others added 2 commits December 19, 2025 10:34
- Add transpiler transform to rewrite information_schema.columns queries
  to use information_schema_columns_compat view (which maps VARCHAR -> text)
- Fix: initInformationSchema was never called, now called during connection setup
- Add test to verify the rewrite works correctly

PostgreSQL clients expect data_type to return 'text' or 'character varying'
for string columns, but DuckDB returns 'VARCHAR'. The compat view handles
this conversion.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
When DuckLake is the default database, view creation causes transaction
conflicts between concurrent connections. Fix by switching to memory
database before creating views, then switching back.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@EDsCODE EDsCODE force-pushed the fix/information-schema-columns-rewrite branch from d162403 to f197f8d Compare December 19, 2025 18:44
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.

2 participants