Skip to content

duckdb: resolve the rowid pseudo-column - #4721

Closed
kyleconroy wants to merge 1 commit into
mainfrom
claude/project-thread-vhhe51
Closed

kyleconroy wants to merge 1 commit into
mainfrom
claude/project-thread-vhhe51

Conversation

@kyleconroy

Copy link
Copy Markdown
Collaborator

Requested by Kyle · project thread

Fixes #4676.

Every DuckDB base table has a rowid pseudo-column, but the engine only knew the columns a table declares, so SELECT rowid ..., WHERE rowid = $1 and ORDER BY rowid all failed with unknown column "rowid".

Change

convertCreateTableInfo adds rowid to each table as a hidden BIGINT column, the same way the SQLite engine adds the hidden columns of an fts5 table (IsHidden on the ColumnDef). The core catalog then resolves it by name while keeping it out of star expansions, INSERT targets without a column list, and the table's model. It is nullable because that is what DuckDB's DESCRIBE reports. A table that declares its own rowid column keeps that column. CREATE TABLE ... AS is unchanged.

Tests

Adds the analysis-only case analyze_rowid/duckdb. It covers bare and qualified rowid, a rowid parameter, SELECT * without rowid, INSERT without a column list, DELETE ... RETURNING *, and a table that declares its own rowid. The case fails on main with the errors from the issue. TestReplay/base passes, and the opt-in core context shows the same failures as on main. I couldn't run the goldeneye DuckDB check here, because the DuckDB CLI download is blocked from this environment.

Relation to #4697

#4697 by @ruziba3vich takes the same approach in the converter, and this PR keeps that design. The difference is the test: this PR covers the fix with an analyze case instead of a generated-Go golden, since only the analysis result matters here. The UPDATE query from #4697's case is left out. If this merges, #4697 can be closed as superseded, with credit to its author.


Generated by Claude Code

Every DuckDB base table offers a rowid that a query can select, filter on
and order by. The converter now adds it to each table as a hidden, nullable
BIGINT column, the way the SQLite engine adds the hidden columns of an fts5
table, so it resolves by name but stays out of star expansions, INSERT
targets and the table's model. A table that declares its own rowid keeps
that column.

Fixes #4676

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4JY6kCxkjBm6hN7Lf3
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.

duckdb: the rowid pseudo-column is an unknown column

2 participants