Skip to content

Make functions discoverable from duckdb_functions() - #13

Merged
avaitla merged 2 commits into
mainfrom
function-descriptions
Oct 23, 2026
Merged

avaitla merged 2 commits into
mainfrom
function-descriptions

Conversation

@avaitla

@avaitla avaitla commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Closes #11.

Summary

All three table functions now carry metadata in duckdb_functions():

before after
description 0 / 3 3 / 3
examples 0 / 3 3 / 3 (runnable as written, result as trailing comment)
categories 0 / 3 3 / 3 (diff, data_quality)
real parameter names col0, col1, … left, right, pk, …

How

  • Functions are registered through CreateTableFunctionInfo with a FunctionDescription. on_conflict = ALTER_ON_CONFLICT matches what the bare RegisterFunction(TableFunction) overload does.
  • Parameter names are set on the signature, not desc.parameter_names. In DuckDB 2.0, duckdb_functions() reads names from the signature (FunctionSignature::GetParameters()); FunctionDescription::parameter_names is only a fallback when the counts don't match. The relation arguments are registered as positional-only left / right, so call syntax is unchanged and "no matching function" errors now show table_diff(left VARCHAR, right VARCHAR, /, *, pk ANY, …).
  • Examples use inline VALUES, so they run on a fresh connection with no setup.

Test plan

  • make test: 11/11 pass, including the new test/sql/function_metadata.test (names, description/examples/categories present, and each example's output)
  • Pulled examples[1] for each function out of duckdb_functions() and ran the result with .read: all three run as written and match their comments
  • CI green

🤖 Generated with Claude Code

avaitla and others added 2 commits October 23, 2026 17:42
Register table_diff, table_diff_summary and schema_diff through
CreateTableFunctionInfo with a FunctionDescription (description, one
runnable example with its result as a trailing comment, categories), and
name the two positional parameters left / right in the signature so
duckdb_functions() no longer reports col0 / col1. on_conflict is set to
ALTER_ON_CONFLICT to match the bare RegisterFunction overload.

Adds test/sql/function_metadata.test covering the metadata and the
examples' output.

Closes #11

Co-Authored-By: Claude <noreply@anthropic.com>
Join two lines in the new registration helpers as clang-format 11 wants,
and reflow the CMAKE_CXX_STANDARD line as cmake-format wants (the v2.0
code-quality check also formats CMakeLists.txt; main fails on it since
the v2.0.0 upgrade).

Co-Authored-By: Claude <noreply@anthropic.com>
@avaitla
avaitla merged commit 00f636e into main Oct 23, 2026
15 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.

Docs: make duck_diff's functions discoverable from duckdb_functions()

1 participant