Skip to content

fix: add missing end_snapshot IS NULL filter in Postgres and MySQL providers#88

Merged
zfarrell merged 1 commit into
datafusion-contrib:mainfrom
ChristianCasazza:fix/postgres-mysql-missing-snapshot-filter
Mar 18, 2026
Merged

fix: add missing end_snapshot IS NULL filter in Postgres and MySQL providers#88
zfarrell merged 1 commit into
datafusion-contrib:mainfrom
ChristianCasazza:fix/postgres-mysql-missing-snapshot-filter

Conversation

@ChristianCasazza
Copy link
Copy Markdown
Contributor

Fixes #87.

The Postgres and MySQL get_table_structure() queries were missing AND end_snapshot IS NULL, returning expired column rows alongside current ones. This causes duplicate column names in the Arrow schema when a column's properties have changed over time.

The DuckDB and SQLite providers already have this filter. Two lines changed, one in each file.

…t_table_structure()

The PostgreSQL and MySQL metadata providers were missing
'AND end_snapshot IS NULL' in get_table_structure(), causing
all historical column rows to be returned instead of only current ones.

When a column's properties change (e.g. nullability), DuckLake closes
the old row (end_snapshot = N) and creates a new one (end_snapshot = NULL).
Without the filter, both rows are returned, creating duplicate column names
in the Arrow schema, which DataFusion rejects with:

  Schema error: Schema contains duplicate qualified field name

The DuckDB provider already has this filter via the shared
SQL_GET_TABLE_COLUMNS constant. The SQLite provider has it in its
inline SQL. Only PostgreSQL and MySQL were missing it.
@zfarrell zfarrell merged commit c46f5c6 into datafusion-contrib:main Mar 18, 2026
6 of 8 checks passed
@zfarrell
Copy link
Copy Markdown
Collaborator

Thanks @ChristianCasazza!

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.

Postgres and MySQL providers missing end_snapshot filter in get_table_structure()

2 participants