Skip site navigation (1) Skip section navigation (2)

create a box from point?

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org>
Subject: create a box from point?
Date: 2010-08-23 11:24:42
Message-ID: BLU0-SMTP4629C36D164F1069785F15AC820@phx.gbl (view raw or flat)
Thread:
Lists: pgsql-novice
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



Responses

pgsql-novice by date

Next:From: Florian HengeDate: 2010-08-23 11:33:43
Subject: xml output
Previous:From: Chip SteeleDate: 2010-08-20 20:15:32
Subject: Streaming Replication in PostgreSQL9.0 b4: Standby dropping connections

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group