Skip to content

Bind NULL for a nullable parameter a C wrapper derives from another argument - #182

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/nullable-derived-arg-binds-null
Oct 9, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/nullable-derived-arg-binds-null

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

A parameter MEOS documents as possibly NULL that the PostgreSQL wrapper fills from a value it
derives from an SQL argument another parameter already carries, and not from an SQL argument of
its own, is bound to NULL for a binding: asMFJSON(tgeompoint, ...), whose wrapper
Temporal_as_mfjson names the coordinate reference system with srs = get_srs_cache_by_srid(fcinfo,
srid, ...) from the SRID of its temporal argument and calls temporal_as_mfjson(temp, ..., srs),
states srs as NULL, so a binding calls the function with NULL and MEOS names the system from its
own reference systems. A local assigned from an SQL argument, read by PG_GETARG under a running
index or converted from an array, and a state threaded through the call's own result keep
carrying their argument.

Witness: on MobilityDB master 8a9bc20b62 temporal_as_mfjson documents srs as possibly NULL, its
wrapper derives srs from the SRID of the temporal value through the table spatial_ref_sys, and
master's parser classifies srs as a local the caller supplies, so the catalog states it as an SQL
argument the twenty asMFJSON signatures do not carry.

Measured: over MobilityDB master 8a9bc20b62 run.py states srs as NULL on 20 of the 20 signatures of
temporal_as_mfjson, and every other key of the catalog equals that of master's parser. The suite
passes the new tests of tests/test_boundargs.py HostDerivedNullableTests, the first of which fails
with master's parser while the three stating that an argument read by a running index, an array
converted into two parameters and an aggregate state stay unbound pass with both, with 432 passed
and 84 skipped against 428 and 84 with master's parser.

Why: a binding calls the C function with the parameters the SQL function carries, and leaving
the derived one to MEOS gives it the name MEOS states for the SRID of the value.

…rgument

A parameter MEOS documents as possibly NULL that the PostgreSQL wrapper fills from a value it
derives from an SQL argument another parameter already carries, and not from an SQL argument of
its own, is bound to NULL for a binding: asMFJSON(tgeompoint, ...), whose wrapper
Temporal_as_mfjson names the coordinate reference system with srs = get_srs_cache_by_srid(fcinfo,
srid, ...) from the SRID of its temporal argument and calls temporal_as_mfjson(temp, ..., srs),
states srs as NULL, so a binding calls the function with NULL and MEOS names the system from its
own reference systems. A local assigned from an SQL argument, read by PG_GETARG under a running
index or converted from an array, and a state threaded through the call's own result keep
carrying their argument.

Witness: on MobilityDB master 8a9bc20b62 temporal_as_mfjson documents srs as possibly NULL, its
wrapper derives srs from the SRID of the temporal value through the table spatial_ref_sys, and
master's parser classifies srs as a local the caller supplies, so the catalog states it as an SQL
argument the twenty asMFJSON signatures do not carry.

Measured: over MobilityDB master 8a9bc20b62 run.py states srs as NULL on 20 of the 20 signatures of
temporal_as_mfjson, and every other key of the catalog equals that of master's parser. The suite
passes the new tests of tests/test_boundargs.py HostDerivedNullableTests, the first of which fails
with master's parser while the three stating that an argument read by a running index, an array
converted into two parameters and an aggregate state stay unbound pass with both, with 432 passed
and 84 skipped against 428 and 84 with master's parser.

Why: a binding calls the C function with the parameters the SQL function carries, and leaving
the derived one to MEOS gives it the name MEOS states for the SRID of the value.
@estebanzimanyi
estebanzimanyi merged commit e84319b into MobilityDB:master Oct 9, 2026
3 checks passed
@estebanzimanyi
estebanzimanyi deleted the catalog/nullable-derived-arg-binds-null branch October 9, 2026 14:37
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