Skip to content

Conversation

@nicosuave
Copy link
Member

No description provided.

Exposes DuckDB's parser for building IDEs, editors, and query tools:

- tokenize_sql: syntax highlighting with byte positions (uses DuckDB's internal tokenizer)
- parse_statements/num_statements: multi-statement parsing
- is_valid_sql/sql_error_message: syntax validation
- parse_columns/parse_column_types/parse_type_info: result schema introspection
- parse_parameters: prepared statement parameter extraction
- parse_tables/parse_table_names: table reference extraction
- parse_functions/parse_function_names: function call extraction
- parse_where: WHERE clause analysis
- sql_keywords/is_keyword: keyword utilities
- sql_strip_comments: comment removal
- sql_parse_json: full JSON AST access

Also updates to DuckDB v1.4.2 and extension-ci-tools v1.4.2.
Uses DuckDB's json_tree() and json_extract_string() to parse
json_serialize_plan() output instead of manual string manipulation.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

src/parser.c Outdated
Comment on lines 203 to 204
if (bind->query) {
free(bind->query);

Choose a reason for hiding this comment

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

P1 Badge Free duckdb_get_varchar results with duckdb_free

Strings retrieved via duckdb_get_varchar are freed with free (bind->query here and in other bind destructors), but the DuckDB C API specifies that the returned buffer must be destroyed with duckdb_free (see duckdb.h around the duckdb_get_varchar declaration). Using the wrong allocator is undefined and can lead to heap corruption when DuckDB is built with a different allocator. The same pattern appears in other bind destructors that obtain SQL via duckdb_get_varchar (parse_parameters, parse_columns, parse_type_info, parse_tables, tokenize_sql, parse_functions, parse_where), so all those free calls need to switch to duckdb_free.

Useful? React with 👍 / 👎.

- Add duckdb as vcpkg dependency in CI workflow
- Update CMakeLists.txt to find duckdb via vcpkg or system paths
- Fix test ordering issues with DISTINCT results
Downloads DuckDB source via FetchContent for C++ headers (Parser, SimplifiedToken)
without building DuckDB itself. Links against vcpkg libduckdb in CI or system
libduckdb locally.
Fallback mechanism for CI: if vcpkg/system libduckdb not found,
download platform-specific pre-built library from DuckDB releases.
Removes vcpkg dependency.
FetchContent is designed for source code, not pre-built binaries.
Using file(DOWNLOAD) + cmake -E tar for more reliable extraction.
@nicosuave nicosuave merged commit 86b8dfd into main Nov 25, 2025
10 checks passed
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.

2 participants