Re: "IN" in a geometric database using data type "point"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Romain Billoir <billoirr(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: "IN" in a geometric database using data type "point"
Date: 2010-09-26 14:04:42
Message-ID: 29114.1285509882@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Romain Billoir <billoirr(at)gmail(dot)com> writes:
> Hi, i'm trying to request a database using data type "point" using keyword
> "IN" with a list of point generated by PHP, like this:
> 'SELECT * FROM map WHERE position IN ((point(-1,-1), (point(1,-1),
> point(1,1), point(-1,1))'
> but this request returns me an error: operator doesn't exist point = point.

For historical reasons the equality operator for points is named ~=
... which IN doesn't understand. I think your best bet is to spell
it out instead of using the IN shorthand:

SELECT * FROM map WHERE position ~= point(-1,-1) or position ~= point(1,-1)
or position ~= point(1,1) ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-09-26 14:07:23 Re: 9.0RC1 error variable not found in subplantarget lists
Previous Message David Fetter 2010-09-26 14:02:34 Re: Exclusion constraint issue