Обсуждение: create a box from point?

Поиск
Список
Период
Сортировка

create a box from point?

От
Frank Bax
Дата:
PGSQL 8.4.1  How can I create a box from point?

create table geo (id int, p point);
insert into geo values(1,'(143.032,-81.2315)');

SELECT ((p[0]-.5,p[1]-.5),(p[0]+.5,p[1]+.5)) AS boxx from geo;
                    boxx
-------------------------------------------
  ("(142.532,-81.7315)","(143.532,-80.7315)")

SELECT ((p[0]-.5,p[1]-.5),(p[0]+.5,p[1]+.5))::box AS boxx from geo;
ERROR:  cannot cast type record to box



Re: create a box from point?

От
Krzysztof Hoffmann
Дата:
This should works:

SELECT box( point(p[0]-.5,p[1]-.5) , point(p[0]+.5,p[1]+.5)) AS boxx from geo;

Krzysztof Hoffmann

2010/8/23 Frank Bax <fbax@sympatico.ca>
PGSQL 8.4.1  How can I create a box from point?

create table geo (id int, p point);
insert into geo values(1,'(143.032,-81.2315)');

SELECT ((p[0]-.5,p[1]-.5),(p[0]+.5,p[1]+.5)) AS boxx from geo;
                  boxx
-------------------------------------------
 ("(142.532,-81.7315)","(143.532,-80.7315)")

SELECT ((p[0]-.5,p[1]-.5),(p[0]+.5,p[1]+.5))::box AS boxx from geo;
ERROR:  cannot cast type record to box



--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice