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

Re: create a box from point?

From: Krzysztof Hoffmann <krzysiekpl(at)gmail(dot)com>
To: Frank Bax <fbax(at)sympatico(dot)ca>
Cc: PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: create a box from point?
Date: 2010-08-23 11:53:31
Message-ID: AANLkTinWT8=gvrbdgC7ziGN_J4xYeXgEj_Q2paNYq3ib@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
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(at)sympatico(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>

In response to

pgsql-novice by date

Next:From: Thom BrownDate: 2010-08-23 12:09:05
Subject: Re: xml output
Previous:From: Florian HengeDate: 2010-08-23 11:33:43
Subject: xml output

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