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 A267AD1DA3E for ; Fri, 13 Feb 2004 17:10:35 +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 65157-05 for ; Fri, 13 Feb 2004 13:10:39 -0400 (AST) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 24DA0D1DAA9 for ; Fri, 13 Feb 2004 13:10:33 -0400 (AST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 878396; Fri, 13 Feb 2004 08:29:45 -0800 Message-ID: <402CFC66.5060707@joeconway.com> Date: Fri, 13 Feb 2004 08:33:42 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: David , pgsql-sql@postgresql.org Subject: Re: arrays and polygons References: <001e01c3f21b$a8c0eb00$2d650c81@ad.kent.ac.uk> <2252.1076684559@sss.pgh.pa.us> In-Reply-To: <2252.1076684559@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/154 X-Sequence-Number: 16845 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