Skip to content

State what a wrapper passes for an argument left to its NULL default - #185

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/null-default-binds
Oct 10, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/null-default-binds

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

A SQL signature states in nullDefaultBinds, for each argument declared DEFAULT NULL, what its
wrapper passes the MEOS function when the call leaves that argument out, which PostgreSQL passes
as NULL: tintSeqSetGaps(tint[], maxt interval DEFAULT NULL, maxdist float DEFAULT NULL) passes
maxt NULL and maxdist -1.0, tcbufferSeq(tcbuffer, text DEFAULT NULL) passes the interpolation
INTERP_NONE, raquetRead(text, quadbin DEFAULT NULL) passes the quadbin 0.
attach_null_default_binds of parser/boundargs.py reads each value from the wrapper: the literal a
local starts from and replaces only under PG_NARGS() > k (#_guarded_default), the interpolation
of the signature's temporal type it takes when the call carries no k (#_type_choice), or the
literal of x = PG_ARGISNULL(k) ? literal : ...; it states a position only when every parameter
the argument feeds (#_caller_index) has one, and only on a signature whose CREATE FUNCTION is not
STRICT, since a STRICT one answers NULL without calling the wrapper. _create_fn_stmts of
parser/sqlfn.py reports the strictness of a statement on request, which _wrapper_sql_strict
keys as #_signature_wrapper matches a signature.

Witness: on MEOS-API master 8818c00 over MobilityDB master 647acbe4ed the catalog states
argDefaults NULL for 74 signatures and nothing of what their wrappers pass for them, so a binding
either refuses the shorter call, as the typed Spark and Flink surfaces of JMEOS refuse
tintSeqSetGaps(tint[], interval), or passes the default of the C type, as the Spark UDF of
raquetRead passes 0 for a quadbin by coincidence.

Measured over MobilityDB master 647acbe4ed: run.py states 92 positions over 71 signatures (the
17 SeqSetGaps, the 33 one-argument Seq and SeqSet forms, 19 of
appendInstantTransition and the 2 raquetRead), every value the one its wrapper passes; the 3 left
(raquet, clip, reclass) fill a NULL argument through statements the rules do not read; every other
key of every function equals that of master's parser. The suite passes 525 tests with none
skipped, among them the two of tests/test_boundargs.py NullDefaultBindTests.

Why: a call leaving an argument to its default answers as PostgreSQL does only when the binding
passes what the wrapper passes, and that value is the catalog's to state.

A SQL signature states in nullDefaultBinds, for each argument declared DEFAULT NULL, what its
wrapper passes the MEOS function when the call leaves that argument out, which PostgreSQL passes
as NULL: tintSeqSetGaps(tint[], maxt interval DEFAULT NULL, maxdist float DEFAULT NULL) passes
maxt NULL and maxdist -1.0, tcbufferSeq(tcbuffer, text DEFAULT NULL) passes the interpolation
INTERP_NONE, raquetRead(text, quadbin DEFAULT NULL) passes the quadbin 0.
attach_null_default_binds of parser/boundargs.py reads each value from the wrapper: the literal a
local starts from and replaces only under PG_NARGS() > k (#_guarded_default), the interpolation
of the signature's temporal type it takes when the call carries no k (#_type_choice), or the
literal of `x = PG_ARGISNULL(k) ? literal : ...`; it states a position only when every parameter
the argument feeds (#_caller_index) has one, and only on a signature whose CREATE FUNCTION is not
STRICT, since a STRICT one answers NULL without calling the wrapper. _create_fn_stmts of
parser/sqlfn.py reports the strictness of a statement on request, which _wrapper_sql_strict
keys as #_signature_wrapper matches a signature.

Witness: on MEOS-API master 8818c00 over MobilityDB master 647acbe4ed the catalog states
argDefaults NULL for 74 signatures and nothing of what their wrappers pass for them, so a binding
either refuses the shorter call, as the typed Spark and Flink surfaces of JMEOS refuse
tintSeqSetGaps(tint[], interval), or passes the default of the C type, as the Spark UDF of
raquetRead passes 0 for a quadbin by coincidence.

Measured over MobilityDB master 647acbe4ed: run.py states 92 positions over 71 signatures (the
17 <type>SeqSetGaps, the 33 one-argument <type>Seq and <type>SeqSet forms, 19 of
appendInstantTransition and the 2 raquetRead), every value the one its wrapper passes; the 3 left
(raquet, clip, reclass) fill a NULL argument through statements the rules do not read; every other
key of every function equals that of master's parser. The suite passes 525 tests with none
skipped, among them the two of tests/test_boundargs.py NullDefaultBindTests.

Why: a call leaving an argument to its default answers as PostgreSQL does only when the binding
passes what the wrapper passes, and that value is the catalog's to state.
@estebanzimanyi
estebanzimanyi merged commit d259ddb into MobilityDB:master Oct 10, 2026
3 checks passed
@estebanzimanyi
estebanzimanyi deleted the catalog/null-default-binds branch October 10, 2026 05:48
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