pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David <de4@kent.ac.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: arrays and polygons
Date: Fri, 13 Feb 2004 08:33:42 -0800
Message-ID: <402CFC66.5060707@joeconway.com> (raw)
In-Reply-To: <2252.1076684559@sss.pgh.pa.us>
References: <001e01c3f21b$a8c0eb00$2d650c81@ad.kent.ac.uk>
	<2252.1076684559@sss.pgh.pa.us>

Tom Lane wrote:
> "David" <de4@kent.ac.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



view thread (4+ messages)  latest in thread

Message-ID: <402CFC66.5060707@joeconway.com>
Permalink:  ../402CFC66.5060707@joeconway.com/
Also on:    postgresql.org/message-id/402CFC66.5060707@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mail@joeconway.com, tgl@sss.pgh.pa.us, de4@kent.ac.uk
  Subject: Re: arrays and polygons
  In-Reply-To: <402CFC66.5060707@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox