[postgis-users] NOT IN and IN predicates are true at the same time
Caleb Land
caleb at land.fm
Wed Oct 25 07:31:49 PDT 2023
Hi,
I’m very new to PostGIS and I’m running into a seemingly strange situation.
I have a table of geography points, and I am trying to select rows where the point is NOT IN a given list:
SELECT "address_coordinates".* FROM "address_coordinates" WHERE "address_coordinates"."address_id" = 2269 AND (lonlat NOT IN ('POINT(-100.768049 46.784703)’))
However, this returns rows where the the lonlat column IS the same point because I get the same result row when I run the query with the NOT removed:
SELECT "address_coordinates".* FROM "address_coordinates" WHERE "address_coordinates"."address_id" = 2269 AND (lonlat IN ('POINT(-100.768049 46.784703)’))
I can get the expected results if I move the NOT to before the column name:
SELECT "address_coordinates".* FROM "address_coordinates" WHERE "address_coordinates"."address_id" = 2269 AND NOT (lonlat IN ('POINT(-100.768049 46.784703)’))
Any idea what is causing this?
Caleb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20231025/229133b6/attachment.htm>
More information about the postgis-users
mailing list