Skip to content

Commit

Permalink
Fix function cache of box2d (#8101)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
msullivan authored Dec 11, 2024
1 parent bde8e9e commit 1e60dc5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions edb/pgsql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion edb/server/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',)
Expand Down

0 comments on commit 1e60dc5

Please sign in to comment.