From 26aa0b52d21d0618d95889f5ca8f493a71319f01 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Wed, 15 Jul 2026 20:05:23 +0200 Subject: [PATCH] Carry the full per-type SQL name family in sqlSignatures A base-type-generic MEOS C function is exposed by MobilityDB as a per-type NAME FAMILY: tintInst, tbigintInst, ..., ttextInst are distinct CREATE FUNCTIONs all backed by the one wrapper Temporal_to_tinstant, and likewise the sequence/sequence-set constructors, the _in/_out/_recv/_send and From{Binary,HexWKB,MFJSON} I/O families, and the value/transform families. The single @sqlfn doxygen tag names only one representative, so sqlSignatures kept just that name's overload and every binding had to hand-write the rest. Keep every CREATE FUNCTION overload the wrapper backs and stamp each with its own sqlName when the wrapper backs more than one distinct name; single-name wrappers stay {args, ret} unchanged. A binding registers each overload by its own SQL name (falling back to the function's sqlfn when no sqlName is present) instead of hand-writing the non-representative types. --- parser/sqlfn.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/parser/sqlfn.py b/parser/sqlfn.py index 07e1037..df58590 100644 --- a/parser/sqlfn.py +++ b/parser/sqlfn.py @@ -286,23 +286,34 @@ def attach_sqlfn_map(idl, meos_src, mdb_src, sql_src=None): f["sqlReturnType"] = next(iter(rets)) elif len(rets) > 1: f["sqlReturnTypeAll"] = sorted(rets) - # The EXACT per-overload SQL signatures for THIS @sqlfn name — the mechanical - # registration surface. A binding emits one registration per entry over the - # concrete arg types, with NO type-scope heuristic (minInstant lands on exactly - # its {tint,tbigint,tfloat,ttext} overloads). One wrapper backs several @sqlfn - # names (Temporal_to_tinstant <- tintInst/tgeometryInst/...), so keep only the - # overloads whose CREATE FUNCTION name is this function's @sqlfn. + # The EXACT per-overload SQL signatures — the mechanical registration surface. + # A binding emits one registration per entry over the concrete arg types, with + # NO type-scope heuristic (minInstant lands on exactly its {tint,tbigint,tfloat, + # ttext} overloads), under the entry's own SQL name. + # One C wrapper very commonly backs a per-type NAME FAMILY: Temporal_to_tinstant + # is exposed as tintInst/tbigintInst/.../ttextInst — one CREATE FUNCTION per base + # type, all resolving to the one wrapper — and likewise the constructor, I/O + # (From{Binary,HexWKB,MFJSON}, _in/_out/_recv/_send) and transform families. The + # single @sqlfn doxygen tag names only ONE representative, so keep EVERY overload + # and stamp it with `sqlName` when the wrapper backs more than one distinct name; + # a binding registers each `Inst`/`Seq`/... by its own name rather than + # hand-writing the non-representative types. Single-name wrappers stay {args,ret} + # unchanged (their name is the function's `sqlfn`), so the common case is a no-op. # `argDefaults` (the per-arg literal SQL default, None for a required arg) is # attached ONLY for a signature that actually has an optional arg, so a binding # can render the shorter overload of a SQL-optional argument with its omitted # value; default-free signatures stay {args, ret} unchanged. + fam_names = {s["sqlName"] for s in sigs} + multiname = len(fam_names) > 1 own = [] for s in sigs: - if s["sqlName"] != f["sqlfn"]: + if not multiname and s["sqlName"] != f["sqlfn"]: continue entry = {"args": s["args"], "ret": s["ret"]} if any(d is not None for d in s["argDefaults"]): entry["argDefaults"] = s["argDefaults"] + if multiname: + entry["sqlName"] = s["sqlName"] own.append(entry) if own: f["sqlSignatures"] = own