Skip to content

feat: propagate Postgres table and column comments through DuckDB metadata#468

Open
anirudhp-ops wants to merge 1 commit into
duckdb:mainfrom
anirudhp-ops:main
Open

feat: propagate Postgres table and column comments through DuckDB metadata#468
anirudhp-ops wants to merge 1 commit into
duckdb:mainfrom
anirudhp-ops:main

Conversation

@anirudhp-ops
Copy link
Copy Markdown

Summary

Closes #450

This PR adds support for Postgres schema comments to show up when
querying DuckDB metadata functions.

Changes

Modified GetInitializeQuery in postgres_table_set.cpp to join
against pg_description system catalog, surfacing both table-level
and column-level comments.

  • Table comments are now visible via duckdb_tables()
  • Column comments are now visible via duckdb_columns()

Testing
Verified manually by setting comments in Postgres and querying
DuckDB metadata:

sql
-- Set comments in Postgres
COMMENT ON TABLE test_comments IS 'this is a test table comment';
COMMENT ON COLUMN test_comments.name IS 'this is a column comment';

-- Verify in DuckDB
SELECT comment FROM duckdb_tables() WHERE table_name = 'test_comments';
-- Returns: 'this is a test table comment'

SELECT column_name, comment FROM duckdb_columns() WHERE table_name = 'test_comments';
-- Returns: name | 'this is a column comment'

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.

Include Comments in Schema

1 participant