X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7016AD1CA90 for ; Fri, 13 Feb 2004 17:00:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63594-01 for ; Fri, 13 Feb 2004 13:00:24 -0400 (AST) Received: from mx5.kent.ac.uk (mx5.ukc.ac.uk [129.12.21.36]) by svr1.postgresql.org (Postfix) with ESMTP id 7EC6DD1C7F7 for ; Fri, 13 Feb 2004 13:00:17 -0400 (AST) Received: from pelican.ukc.ac.uk ([129.12.200.26]) by mx5.kent.ac.uk with esmtp (Exim 4.24) id 1Argfi-0005eF-UP; Fri, 13 Feb 2004 17:00:10 +0000 Received: from dhcp665b.ukc.ac.uk ([129.12.102.91] helo=PC2LP076) by pelican.ukc.ac.uk with smtp (Exim 4.22) id 1Argfi-0001uE-6X; Fri, 13 Feb 2004 17:00:10 +0000 Message-ID: <005b01c3f252$d6d59ef0$5b660c81@ad.kent.ac.uk> From: "David" To: "Joe Conway" , "Tom Lane" Cc: References: <001e01c3f21b$a8c0eb00$2d650c81@ad.kent.ac.uk> <2252.1076684559@sss.pgh.pa.us> <402CFC66.5060707@joeconway.com> Subject: Re: arrays and polygons Date: Fri, 13 Feb 2004 17:00:10 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-UKC-Mail-System: No virus detected X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/153 X-Sequence-Number: 16844 Thanks to you both that helped enormously, Dave ----- Original Message ----- From: "Joe Conway" To: "Tom Lane" Cc: "David" ; Sent: Friday, February 13, 2004 4:33 PM Subject: Re: [SQL] arrays and polygons > Tom Lane wrote: > > "David" 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 >