From 283b250586ae0043f799b540834dba0d4fba02c5 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Wed, 14 Oct 2026 11:28:18 +0200 Subject: [PATCH] Declare append and merge generic over every temporal type temporal_append_tsequence, temporal_merge and temporal_merge_array back appendSequence and merge, which MobilityDB declares over all 20 temporal types, each through one wrapper shared with trgeometry_append_tsequence, trgeometry_merge and trgeometry_merge_array. A claimant of a shared wrapper keeps the signatures of its type scope, and the scope signals read the wrong fact for these three: the C parameter type of the bool expand parameter of temporal_append_tsequence (tbool), and the trgeometry branch of the bodies of temporal_merge and temporal_merge_array (trgeometry). Each kept one signature, and a binding generated from the catalog registers appendSequence over tbool and merge over trgeometry alone. They are declared in meta/type-scope.json with the scope "*", as temporal_append_tinstant is. Witness: tests/test_typescope.py requires each of the three to serve tbool, tint, tfloat, ttext, tgeompoint, tgeogpoint and trgeometry in the generated catalog; it fails over the catalog of master and passes here. Measured: over MobilityDB f935759e00, the catalog differs from master's in these three functions alone, each going from 1 signature to 20 and losing none (sqlSignatures, and the return type it states); the 6557 others are identical, as are the other sections. The suite fails the three tests it fails on master at the same commit (test_representative_symbols_land_in_their_family and two struct layout tests), and no other. Why: a binding registers the signatures the catalog attributes to a function, so a generic function whose scope is misread loses every type but one on every surface generated from it. --- meta/type-scope.json | 12 ++++++++++++ tests/test_typescope.py | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/meta/type-scope.json b/meta/type-scope.json index bb8530e..5a5b4e1 100644 --- a/meta/type-scope.json +++ b/meta/type-scope.json @@ -6,6 +6,18 @@ "types": "*", "note": "Generic over Temporal *: appends to any temporal type." }, + "temporal_append_tsequence": { + "types": "*", + "note": "Generic over Temporal *: appends to any temporal type. Its bool expand parameter is no scope." + }, + "temporal_merge": { + "types": "*", + "note": "Generic over Temporal *: merges any two temporal values of one type. Its trgeometry branch is no scope." + }, + "temporal_merge_array": { + "types": "*", + "note": "Generic over Temporal *: merges an array of temporal values of one type. Its trgeometry branch is no scope." + }, "temporal_at_values": { "types": "*", "note": "Generic over Temporal *: restricts any temporal type to a value set." diff --git a/tests/test_typescope.py b/tests/test_typescope.py index 7f4511f..c7596c0 100644 --- a/tests/test_typescope.py +++ b/tests/test_typescope.py @@ -180,6 +180,16 @@ def test_the_array_accessors_serve_every_temporal_type(self): self.assertTrue({'tint', 'tfloat', 'ttext', 'tgeompoint', 'tgeogpoint'} <= first, f'{name} serves {sorted(first)}') + def test_append_and_merge_serve_every_temporal_type(self): + # as #test_the_array_accessors_serve_every_temporal_type: the bool expand parameter of + # temporal_append_tsequence and the trgeometry branch of temporal_merge read as scopes, + # keeping tbool and trgeometry alone + for name in ('temporal_append_tsequence', 'temporal_merge', 'temporal_merge_array'): + first = {s['args'][0].rstrip('[]') + for s in self.fns[name].get('sqlSignatures') or ()} + self.assertTrue({'tbool', 'tint', 'tfloat', 'ttext', 'tgeompoint', 'tgeogpoint', + 'trgeometry'} <= first, f'{name} serves {sorted(first)}') + if __name__ == '__main__': unittest.main()