Skip to content

Pin the StatementType count in the C API - #26003

Merged
Mytherin merged 1 commit into
duckdb:v2.0-cyanopterafrom
carlopi:enum_size
Sep 22, 2026
Merged

Mytherin merged 1 commit into
duckdb:v2.0-cyanopterafrom
carlopi:enum_size

Conversation

@carlopi

@carlopi carlopi commented Sep 22, 2026

Copy link
Copy Markdown
Member

The v2 C API surfaces StatementType under the same numeric values, but core had no count sentinel, so a member appended in core could only be caught by two runtime tests probing the values past the last known one.

STATEMENT_TYPE_COUNT makes that a static_assert: appending a member shifts the count and fails to compile until the new type has an id in the v2 spec. The two probe tests are no longer needed.

Originally first commit at #25990, but as pointed out better reviewed independently.

Newer version of #25972

The v2 C API surfaces StatementType under the same numeric values, but
core had no count sentinel, so a member appended in core could only be
caught by two runtime tests probing the values past the last known one.

STATEMENT_TYPE_COUNT makes that a static_assert: appending a member
shifts the count and fails to compile until the new type has an id in
the v2 spec. The two probe tests are no longer needed.

@evertlammerts evertlammerts left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with apologies for the long wait times for the test, this is much better.

@Mytherin
Mytherin added this pull request to the merge queue Sep 22, 2026
Merged via the queue into duckdb:v2.0-cyanoptera with commit d4e7256 Sep 22, 2026
56 checks passed
@carlopi
carlopi deleted the enum_size branch September 22, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants