Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 1ECB91337BEB for ; Wed, 16 Feb 2011 13:18:11 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 47670-02-2 for ; Wed, 16 Feb 2011 17:18:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 709C41337B90 for ; Wed, 16 Feb 2011 13:18:02 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p1GHHxYI012631; Wed, 16 Feb 2011 12:17:59 -0500 (EST) To: RW Shore cc: pgsql-jdbc@postgresql.org Subject: Re: Array of box not supported? In-reply-to: References: Comments: In-reply-to RW Shore message dated "Wed, 16 Feb 2011 11:25:47 -0500" Date: Wed, 16 Feb 2011 12:17:59 -0500 Message-ID: <12630.1297876679@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/101 X-Sequence-Number: 21499 RW Shore writes: > To insert into a box[ ], I need to convert the individual boxes into a > string. I get a "malformed array literal" error with any of the following > formats for a 1 dimensional array with two boxes: > {"1.0,1.0,0.0,0.0","10.0,10.0,0.0,0.0"} > {"((1.0,1.0),(0.0,0.0))","((10.0,10.0),(0.0,0.0))"} > {"(1.0,1.0),(0.0,0.0)","(10.0,10.0),(0.0,0.0)"} For historical reasons (well, I can see why they did it, but it's still weird), array of box uses semicolon not comma as the delimiter between array elements. regression=# select '{"1.0,1.0,0.0,0.0","10.0,10.0,0.0,0.0"}'::box[]; ERROR: malformed array literal: "{"1.0,1.0,0.0,0.0","10.0,10.0,0.0,0.0"}" LINE 1: select '{"1.0,1.0,0.0,0.0","10.0,10.0,0.0,0.0"}'::box[]; ^ regression=# select '{"1.0,1.0,0.0,0.0";"10.0,10.0,0.0,0.0"}'::box[]; box ----------------------------- {(1,1),(0,0);(10,10),(0,0)} (1 row) The advantage is you don't need double quotes: regression=# select '{1.0,1.0,0.0,0.0;10.0,10.0,0.0,0.0}'::box[]; box ----------------------------- {(1,1),(0,0);(10,10),(0,0)} (1 row) Whether this requires any special pushups on the JDBC side is beyond my ken. regards, tom lane