Re: arrays and polygons

From: "David" <de4(at)kent(dot)ac(dot)uk>
To: "Joe Conway" <mail(at)joeconway(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: arrays and polygons
Date: 2004-02-13 17:00:10
Message-ID: 005b01c3f252$d6d59ef0$5b660c81@ad.kent.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks to you both that helped enormously,

Dave

----- Original Message -----
From: "Joe Conway" <mail(at)joeconway(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David" <de4(at)kent(dot)ac(dot)uk>; <pgsql-sql(at)postgresql(dot)org>
Sent: Friday, February 13, 2004 4:33 PM
Subject: Re: [SQL] arrays and polygons

> Tom Lane wrote:
> > "David" <de4(at)kent(dot)ac(dot)uk> writes:
> >>INSERT INTO species (location) VALUES ('{((432,89), (45,87), (89,87)),
> >>((54,78), (34,98))};
> >
> > I think you'd need to double-quote each polygon within the array
> > literal.
> >
> > '{"((432,89), (45,87), (89,87))", "..."}'
> >
> > The array parser doesn't think parens are special, so it's not going to
> > magically distinguish array commas from polygon commas for you.
> >
> > BTW, if you are using 7.4, the ARRAY[] constructor syntax might be
> > easier to use.
>
> FWIW, here's what it would look like in 7.4.x:
>
> regression=# select ARRAY['((432,89), (45,87), (89,87))'::polygon,
> '((432,89), (45,87), (89,87))'];
> array
> -------------------------------------------------------------
> {"((432,89),(45,87),(89,87))","((432,89),(45,87),(89,87))"}
> (1 row)
>
> You need to explicitly cast at least the first polygon in order to get
> an array of polygons (versus an array of text).
>
> HTH,
>
> Joe
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mona 2004-02-13 17:45:51 How to unsubscribe
Previous Message Joe Conway 2004-02-13 16:33:42 Re: arrays and polygons