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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: "IN" in a geometric database using data type "point"
Дата
Msg-id 29114.1285509882@sss.pgh.pa.us
обсуждение исходный текст
Ответ на "IN" in a geometric database using data type "point"  (Romain Billoir <billoirr@gmail.com>)
Список pgsql-general
Romain Billoir <billoirr@gmail.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

В списке pgsql-general по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Exclusion constraint issue
Следующее
От: Tom Lane
Дата:
Сообщение: Re: 9.0RC1 error variable not found in subplantarget lists