Closed anmolitor closed 3 years ago
Wrapping the variable in "point" to make a singleton range works, since the @> operator in PostgreSQL works for subranges as well as single values. This should not be necessary though I think.
Does range_x @> ${5 :: Int32}::int4
work? My first guess is that since range @> range
is valid, postgres is infering this by default for some reason. (Unfortunately we can't do much to influence postgres type inference beyond these explicit types.)
Wow yes it does! Then that just solves the issue, thanks :)
Hi, first of all thanks for the great work, I really like working with typesafe SQL queries. Recently, I have added ranges to part of my domain model and was pleased to see the support. But I cannot get the "@>" operation to work. Given the following table
the following simplified query fails
complaining that " Could not deduce (Database.PostgreSQL.Typed.Types.PGParameter "int4range" Int32) arising from a use of `Database.PostgreSQL.Typed.Types.pgEscapeParameter' "
I expected that I accidentally reversed the arguments of the function, but ${5 :: Int32} @> range_x yields the same result. Interestingly, the following query compiles without issues:
where rangeX and rangeY are variables of type Range Int32 respectively.
Can anyone help me out here? :)