Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions parser/typerecover.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"GBOX": "GBOX",
"BOX3D": "BOX3D",
"AFFINE": "AFFINE",
"Jsonb": "Jsonb",
"JsonPath": "JsonPath",
}

_NAMES = "|".join(sorted(_TYPE_MAP, key=len, reverse=True))
Expand Down
16 changes: 16 additions & 0 deletions tests/test_typerecover.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@ def test_no_gserialized_left_collapsed_to_int(self):
self.assertGreater(len(geo_fns), 50,
"GSERIALIZED* collapsed toward int — typerecover regression?")

# ---- jsonb Jsonb / jsonpath JsonPath (opaque PG types, collapse to int) -

def test_jsonb_recovered_when_tjsonb_present(self):
# The temporal-JSONB surface is built only when MEOS is compiled with
# JSON=ON, so this assertion is conditional on the parsed source
# carrying it (skipped otherwise to stay source-agnostic).
jsonb_fns = [n for n in self.by_name
if "jsonb" in n.lower() or "tjsonb" in n.lower()]
if not jsonb_fns:
self.skipTest("source parsed without the JSON=ON tjsonb surface")
# An out-parameter that pre-fix came back as ``int **``.
self.assertIn("Jsonb **", self._param_ctypes("jsonbset_value_n"))
carriers = [f for f in self.by_name.values() if "Jsonb *" in json.dumps(f)]
self.assertGreater(len(carriers), 20,
"Jsonb* collapsed toward int — typerecover regression?")

# ---- other PG-vendored opaque types (Interval / DateADT / Datum / ...) -

def test_interval_params_recovered(self):
Expand Down