From 1e60dc540be454433ebae8ed2ac8b6940098e84b Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Tue, 10 Dec 2024 18:10:12 -0800 Subject: [PATCH] Fix function cache of box2d (#8101) box2d uses `custom_sql_serialization` to return `geometry` from the query, since `box2d` lacks an output function. (Why??) Make sure we use `custom_sql_serialization` when computing the type to use for the cached functions as well. Fixes #8007. I'll try to add a test to edgedb-postgis later. --- edb/pgsql/types.py | 2 ++ edb/server/compiler/compiler.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/edb/pgsql/types.py b/edb/pgsql/types.py index f49033cf67c..8f89387e260 100644 --- a/edb/pgsql/types.py +++ b/edb/pgsql/types.py @@ -446,6 +446,8 @@ def pg_type_from_ir_typeref( return ('uuid',) elif irtyputils.is_abstract(material): return ('anynonarray',) + elif material.custom_sql_serialization and serialized: + return tuple(material.custom_sql_serialization.split('.')) elif material.sql_type: return tuple(material.sql_type.split('.')) else: diff --git a/edb/server/compiler/compiler.py b/edb/server/compiler/compiler.py index 9a8caecdfe0..0d06f73bc0b 100644 --- a/edb/server/compiler/compiler.py +++ b/edb/server/compiler/compiler.py @@ -1880,7 +1880,8 @@ def _build_cache_function( returns_record = True else: return_type = pg_types.pg_type_from_ir_typeref( - ir.expr.typeref.base_type or ir.expr.typeref + ir.expr.typeref.base_type or ir.expr.typeref, + serialized=True, ) if ir.stype.is_tuple(ir.schema): returns_record = return_type == ('record',)