Re: manipulating the POINT data type

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: manipulating the POINT data type
Дата
Msg-id 2702.1028813748@sss.pgh.pa.us
обсуждение исходный текст
Ответ на manipulating the POINT data type  ("Floyd Shackelford" <floyds@4peakstech.com>)
Список pgsql-sql
"Floyd Shackelford" <floyds@4peakstech.com> writes:
> how do i manipulate the POINT data type in a select statement? how do i
> reference the X and Y portions of the point? for instance, can i select the
> X or Y portion of a POINT?

Yeah, pretend it's an array with indexes 0,1.

regression=# create table p (f1 point);
CREATE TABLE
regression=# insert into p values('(12,34)');
INSERT 437746 1
regression=# select f1[0] from p;f1
----12
(1 row)

regression=# select f1[1] from p;f1
----34
(1 row)

regression=# update p set f1[1] = 55;
UPDATE 1
regression=# select * from p;  f1
---------(12,55)
(1 row)

regression=#
        regards, tom lane


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

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: getting oid of an INSERT automatically
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: [GENERAL] looking to speed up SELECT ... LEFT JOIN query