Skip to content

Answer the value at a timestamp from the MEOS entry that reports absence - #21

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:fix/value-at-timestamp-delegates
Sep 3, 2026
Merged

Answer the value at a timestamp from the MEOS entry that reports absence#21
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:fix/value-at-timestamp-delegates

Conversation

@estebanzimanyi

@estebanzimanyi estebanzimanyi commented Sep 3, 2026

Copy link
Copy Markdown
Member

WITNESS: a temporal value holds nothing outside its own span, and MEOS says so
by answering NULL. CreateTemporal reads inner.temptype with no nil test, so
that answer is dereferenced: removing the guard this commit adds takes
ExampleCreateTemporal_absent to

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x4]

and 119 call sites reach CreateTemporal with a result that can be NULL.

The five ValueAtTimestamp accessors compose that path -- each one calls
TemporalAtTimestamptz, discards the conversion error with _, and reads the
instant -- where MEOS publishes the question directly:
tbool_value_at_timestamptz(temp, t, strict, &value) reports whether a value
is there and writes it out, with twins for tint, tfloat, ttext and tgeo. The
generated package already wraps all five, so the accessors delegate to them
across the pointer boundary rather than composing a restriction.

THE SHAPE COMES FROM THE SIBLING BINDINGS, WHICH SEPARATE ABSENCE FROM ERROR.
MEOS.NET's generated accessors return a nullable -- public bool? ValueAtTimestamptz(DateTime t, bool strict), and int? / long? / double?
for its siblings -- with Assert.IsNull covering the absent case in its own
test, while errors travel out of band through SafeExecution. PyMEOS-CFFI
agrees: if result: return out_result[0] ... return None, with _check_error()
raising separately. So absence is an optional result, not a failure. Go spells
an optional as a second result, and the generated wrapper here already returns
(found, value, error), so the accessors return (value, ok, error): ok
false leaves the value at its zero and the error nil, and the error is reserved
for a MEOS failure.

MEASURED: the suite reads 121 result lines, 0 skipped, against 118 before. The
three added examples pin the absent case for the boolean and float accessors
and for CreateTemporal itself, and each fails with the guard removed, so they
witness this change rather than accompany it.

WITNESS: a temporal value holds nothing outside its own span, and MEOS says so
by answering NULL. `CreateTemporal` reads `inner.temptype` with no nil test, so
that answer is dereferenced: removing the guard this commit adds takes
`ExampleCreateTemporal_absent` to

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x4]

and 119 call sites reach `CreateTemporal` with a result that can be NULL.

The five `ValueAtTimestamp` accessors compose that path -- each one calls
`TemporalAtTimestamptz`, discards the conversion error with `_`, and reads the
instant -- where MEOS publishes the question directly:
`tbool_value_at_timestamptz(temp, t, strict, &value)` reports whether a value
is there and writes it out, with twins for tint, tfloat, ttext and tgeo. The
generated package already wraps all five, so the accessors delegate to them
across the pointer boundary rather than composing a restriction.

THE SHAPE COMES FROM THE SIBLING BINDINGS, WHICH SEPARATE ABSENCE FROM ERROR.
MEOS.NET's generated accessors return a nullable -- `public bool?
ValueAtTimestamptz(DateTime t, bool strict)`, and `int?` / `long?` / `double?`
for its siblings -- with `Assert.IsNull` covering the absent case in its own
test, while errors travel out of band through `SafeExecution`. PyMEOS-CFFI
agrees: `if result: return out_result[0] ... return None`, with `_check_error()`
raising separately. So absence is an optional result, not a failure. Go spells
an optional as a second result, and the generated wrapper here already returns
`(found, value, error)`, so the accessors return `(value, ok, error)`: `ok`
false leaves the value at its zero and the error nil, and the error is reserved
for a MEOS failure.

MEASURED: the suite reads 121 result lines, 0 skipped, against 118 before. The
three added examples pin the absent case for the boolean and float accessors
and for `CreateTemporal` itself, and each fails with the guard removed, so they
witness this change rather than accompany it.
@estebanzimanyi
estebanzimanyi force-pushed the fix/value-at-timestamp-delegates branch from 49715b9 to 0c70563 Compare September 3, 2026 10:05
@estebanzimanyi
estebanzimanyi merged commit d1504e8 into MobilityDB:main Sep 3, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the fix/value-at-timestamp-delegates branch September 3, 2026 10:23
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