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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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