[postgis-users] operators and search paths

Chris Mair chris at 1006.org
Thu Oct 6 12:08:37 PDT 2022



> On 6 Oct 2022, at 01:05, Regina Obe <lr at pcorp.us> wrote:
> 
> The  && operator for postgis types is defined in the schema you have postgis
> installed in.  In this case public.
> 
> operators for built-in types are stored in the pg_catalog schema.
> pg_catalog is always in the search path even if you don't explicitly add it.
> 
> So this should work though it's horribly ugly.  It's what we do within
> postgis code.
> 
> SELECT  'POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::public.geometry
> OPERATOR(public.&&)  'POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::public.geometry;
> 
> As to why your below example works,  I suspect it's our geometry auto cast
> to  postgresql box/point/polygon thus using the pg_catalog built in &&
> designed for postgres built-in geometric types.  We have a ticket in place
> for this as it has another ugly side-effect with !=
> https://trac.osgeo.org/postgis/ticket/5175 
> 
> select public.ST_3DMakeBox(public.ST_MakePoint(0,0,0),
> public.ST_MakePoint(2,2,2)) &&
> public.ST_3DMakeBox(public.ST_MakePoint(0,0,0),
> public.ST_MakePoint(2,2,2));


Thanks!

That clears it up for me.

Chris.





More information about the postgis-users mailing list