Capture wrapper-bound literals as shape.boundArgs#60
Merged
estebanzimanyi merged 1 commit intoJul 16, 2026
Merged
Conversation
A MobilityDB PG wrapper can bind a MEOS input to a fixed literal instead of exposing it as a SQL argument: valueAtTimestamp is 2-arg in SQL, yet the wrapper calls temporal_value_at_timestamptz(temp, t, true, &result), hiding strict=true. A binding generated purely from the catalog cannot form that call without the constant. Add a parser pass that reads each PG wrapper body and records, per MEOS function, the literal bound to any argument that is not sourced from PG_GETARG, as shape.boundArgs — the input-side sibling of shape.outParams. A generator emits the bound literal for those params while the SQL signature stays narrow.
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 MEOS function's C signature can be wider than the SQL surface a binding
exposes. The MobilityDB PostgreSQL wrapper reads some arguments from the caller
(
PG_GETARG_*) and binds the remaining scalar inputs to fixed literals. Forexample
valueAtTimestamp(temp, t)is 2-arg in SQL, yet the wrapperTemporal_value_at_timestamptzcallstemporal_value_at_timestamptz(temp, t, true, &result)—strictis bound totrueandresultis an out-param.shape.outParamsalready folds the trailing out-param. This adds the input-sidesibling
shape.boundArgs({param_name: literal}): a new parser pass reads eachwrapper body and records, per MEOS function, the literal bound to any argument
not sourced from
PG_GETARG_*(aPG_GETARGcall, or a local so-assigned, is acaller argument;
&nameis an out-param; only a genuine literal —true/false,a number,
NULL, or an UPPERCASE enum/macro — is recorded). A binding generatedfrom the catalog emits the bound literal for those params
(
fn(temp, t, /*strict*/true, &out)) while the SQL signature stays narrow,instead of hand-writing the constant.
Across the current catalog this captures 27 accessors, including
temporal_value_at_timestamptz({strict: true}), the*_outdecimal-digitdefaults, the
*_as_wkbvariant, the*_shift_scale*flags,temporal_append_tinstant({maxdist, maxt, expand}), andunion_{s,t}box_{s,t}box({strict: true}).The pass mirrors
parser/outparam.pyand slots intorun.pyafter the@sqlfnwrapper map is attached (it needsmdbC).tests/test_boundargs.pycovers the hidden-literal capture, caller-arg exclusion, transform-local
exclusion, and multi-literal (
NULL/number/bool) cases.