Skip to content

Support statement types added in DuckDB 1.5.5 - #1437

Merged
suketa merged 4 commits into
mainfrom
feature/statement-types-duckdb-1.5.5
Aug 1, 2026
Merged

Support statement types added in DuckDB 1.5.5#1437
suketa merged 4 commits into
mainfrom
feature/statement-types-duckdb-1.5.5

Conversation

@suketa

@suketa suketa commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

duckdb.h v1.5.5 adds three duckdb_statement_type values — the only change in the header between v1.5.4 and v1.5.5:

  • DUCKDB_STATEMENT_TYPE_COPY_DATABASE = 28
  • DUCKDB_STATEMENT_TYPE_UPDATE_EXTENSIONS = 29
  • DUCKDB_STATEMENT_TYPE_MERGE_INTO = 30

Without them, #statement_type raises DuckDB::Error: Unknown statement type: 30 for a MERGE INTO statement.

No new functions or signature changes in the header, so nothing else to bind.

Compatibility

Appending to STATEMENT_TYPES is safe on DuckDB 1.4.5 (LTS): those integers are never returned there, and statement_type_to_sym only guards the upper bound. The new test skips on DuckDB < 1.5.0.

Test plan

  • bundle exec rake test against DuckDB 1.5.5: 1360 runs, 2621 assertions, 0 failures, 0 errors
  • New test_statement_type_merge_into asserts :merge_into
  • bundle exec rubocop clean

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for recognizing DuckDB 1.5.5 statement types: COPY DATABASE, UPDATE EXTENSIONS, and MERGE INTO.
    • These statements now return their corresponding statement type instead of raising an error.
  • Tests

    • Added prepared-statement coverage for all three supported statement types, including version-specific validation.
  • Documentation

    • Updated the unreleased changelog with the new statement-type support.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1733937f-3689-4541-93e0-872de02e1701

📥 Commits

Reviewing files that changed from the base of the PR and between 517021b and 88a55dc.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • lib/duckdb/converter/int_to_sym.rb
  • test/duckdb_test/prepared_statement_test.rb
🚧 Files skipped from review as they are similar to previous changes (2)
  • lib/duckdb/converter/int_to_sym.rb
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

The change adds support for three DuckDB 1.5.5 statement types. It updates statement-type conversion, adds version-gated prepared-statement tests, and documents the change.

Changes

Statement type support

Layer / File(s) Summary
Statement conversion and validation
lib/duckdb/converter/int_to_sym.rb, test/duckdb_test/prepared_statement_test.rb, CHANGELOG.md
The converter recognizes copy_database, update_extensions, and merge_into. Version-gated tests verify the corresponding statement types. The changelog records the support.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: otegami

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: support for statement types added in DuckDB 1.5.5.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/statement-types-duckdb-1.5.5

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/duckdb_test/prepared_statement_test.rb`:
- Around line 144-145: Update the version guard in
test_statement_type_merge_into to skip DuckDB library versions below 1.5.5,
replacing the current 1.5.0 minimum while preserving the existing test behavior
for supported versions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ac49f9c2-f902-4eb3-b1c4-2c70f4ca0ab1

📥 Commits

Reviewing files that changed from the base of the PR and between 34970d7 and 1e3cfe7.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • lib/duckdb/converter/int_to_sym.rb
  • test/duckdb_test/prepared_statement_test.rb

Comment thread test/duckdb_test/prepared_statement_test.rb Outdated
suketa and others added 2 commits August 1, 2026 10:55
duckdb.h v1.5.5 adds DUCKDB_STATEMENT_TYPE_COPY_DATABASE (28),
UPDATE_EXTENSIONS (29) and MERGE_INTO (30). Without these entries
#statement_type raised "Unknown statement type" for e.g. MERGE INTO.

Appending to STATEMENT_TYPES is safe on DuckDB 1.4.5 (LTS): those
values are never returned there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The skip gate said 1.5.0, but MERGE INTO SQL has existed since 1.4.0 --
what landed in 1.5.5 is the C API mapping (StatementTypeToC gained the
COPY_DATABASE / UPDATE_EXTENSIONS / MERGE_INTO cases). On 1.5.0-1.5.4 it
falls through to DUCKDB_STATEMENT_TYPE_INVALID, so the test would have
failed there. CI only builds 1.4.5 and 1.5.5, so it would not have caught
it.

Also assert :update_extensions and :copy_database so the array positions
of all three new enum values are pinned. COPY FROM DATABASE expands into
several statements, so it is prepared via ExtractedStatements.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@suketa
suketa force-pushed the feature/statement-types-duckdb-1.5.5 branch from 517021b to b701d23 Compare August 1, 2026 01:55
@suketa
suketa merged commit 130b13f into main Aug 1, 2026
39 checks passed
@suketa
suketa deleted the feature/statement-types-duckdb-1.5.5 branch August 1, 2026 10:56
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.

1 participant