Re: Extracting single coordinate from a box

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Donald Fraser" <demolish(at)cwgsy(dot)net>
Cc: "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Extracting single coordinate from a box
Date: 2003-08-28 16:55:06
Message-ID: 28049.1062089706@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Donald Fraser" <demolish(at)cwgsy(dot)net> writes:
> But when I try something like b[0][0] the passer ignores the second array
> subscript parameter and returns only a "point".

Try this:

regression=# select f1, (f1[1])[0] from box_tbl;
f1 | f1
---------------------+-----
(2,2),(0,0) | 0
(3,3),(1,1) | 1
(2.5,3.5),(2.5,2.5) | 2.5
(3,3),(3,3) | 3
(4 rows)

You need the extra parentheses because the two subscript operations need
to work on fundamentally different datatypes --- if you write f1[1][0]
you are asking to subscript a 2-D array which this isn't.

[ experiments further ... ] Drat, seems that syntax works in 7.4 but
not 7.3. Dunno if that will help you.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Donald Fraser 2003-08-28 17:12:03 Re: Extracting single coordinate from a box
Previous Message Donald Fraser 2003-08-28 16:40:15 Extracting single coordinate from a box