diff --git a/lib/calculation.ex b/lib/calculation.ex index 69150ff..de34819 100644 --- a/lib/calculation.ex +++ b/lib/calculation.ex @@ -59,7 +59,12 @@ defmodule AshPostgres.Calculation do type ) - expr = Ecto.Query.dynamic(type(^expr, ^type)) + expr = + if type do + Ecto.Query.dynamic(type(^expr, ^type)) + else + expr + end {calculation.load, calculation.name, expr} end) diff --git a/lib/expr.ex b/lib/expr.ex index 188de1e..720ee41 100644 --- a/lib/expr.ex +++ b/lib/expr.ex @@ -964,7 +964,11 @@ defmodule AshPostgres.Expr do arg1 = maybe_uuid_to_binary(arg2, arg1, arg1) type = AshPostgres.Types.parameterized_type(arg2, constraints) - Ecto.Query.dynamic(type(^do_dynamic_expr(query, arg1, bindings, embedded?, type), ^type)) + if type do + Ecto.Query.dynamic(type(^do_dynamic_expr(query, arg1, bindings, embedded?, type), ^type)) + else + do_dynamic_expr(query, arg1, bindings, embedded?, type) + end end defp do_dynamic_expr(