Capture SQL argument defaults in the per-overload signatures#40
Merged
estebanzimanyi merged 1 commit intoJul 10, 2026
Merged
Conversation
A CREATE FUNCTION with an optional trailing argument (integer DEFAULT 0, text DEFAULT NULL) is SQL-callable at the shorter arity, but the catalog carried only the arity count (sqlArity < sqlArityMax), not the value to substitute. A binding could pass a null pointer for an omitted DEFAULT NULL argument, but had no way to render a by-value default such as round's precision 0. Capture the literal default per argument, verbatim from the SQL, as argDefaults on each sqlSignatures entry (None for a required argument). The value is attached only to signatures that have an optional argument, so default-free signatures are unchanged; 141 of 2202 functions with signatures gain the field. A binding now emits the shorter overload of an optional argument with its declared value (round(floatset) rounding to 0 decimals) instead of hand-registering it.
estebanzimanyi
added a commit
to MobilityDB/MobilityDuck
that referenced
this pull request
Jul 10, 2026
The catalog now carries the SQL DEFAULT of an optional argument as argDefaults on each sqlSignatures entry (round(floatset, integer DEFAULT 0) -> argDefaults [null, "0"]). The set generator reads it: a scalar-param set function with an optional trailing argument also emits the shorter overload, substituting the declared default (round(floatset) -> set_round(s, 0)), alongside the existing full-arity round(floatset, integer). Both arities are now generated, so the hand SetFunctions::Floatset_round registration, body and declaration are removed. The vendored catalog is regenerated at the same MobilityDB REF (de560130); its only change is the additive argDefaults field. Consumes MobilityDB/MEOS-API#40.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
CREATE FUNCTIONwith an optional trailing argument (integer DEFAULT 0,text DEFAULT NULL) is SQL-callable at the shorter arity, but the catalog carried only the arity count (sqlArity<sqlArityMax), never the value to substitute. A binding could pass a null pointer for an omittedDEFAULT NULLargument, but had no way to render a by-value default such asround's precision0.This captures the literal default per argument, verbatim from the SQL, as
argDefaultson eachsqlSignaturesentry (Nonefor a required argument):_arg_defaultis the exact complement of_bare_type(same split, the other side), so the value is taken straight from the declaration with no interpretation. The field is attached only to signatures that have an optional argument, so default-free signatures stay{args, ret}unchanged — 141 of 2202 functions with signatures gain the field, the rest are byte-identical.A binding can now emit the shorter overload of a SQL-optional argument with its declared value (
round(floatset)rounding to 0 decimals) instead of hand-registering it.Adds
tests/test_sql_defaults.py; full suite 160 passed, 8 skipped.