Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C668A6335DA for ; Sat, 24 Oct 2009 12:47:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 36971-02 for ; Sat, 24 Oct 2009 15:46:51 +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 2F0B9632AE9 for ; Sat, 24 Oct 2009 12:46:52 -0300 (ADT) 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 n9OFkmvi009985; Sat, 24 Oct 2009 11:46:48 -0400 (EDT) To: Richard Huxton cc: Andrew Hall , pgsql-sql@postgresql.org Subject: Re: Table Valued Parameters In-reply-to: <4AE2EC83.6060908@archonet.com> References: <4AE2EC83.6060908@archonet.com> Comments: In-reply-to Richard Huxton message dated "Sat, 24 Oct 2009 13:01:07 +0100" Date: Sat, 24 Oct 2009 11:46:48 -0400 Message-ID: <9984.1256399208@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.352 tagged_above=-10 required=5 tests=AWL=-1.167, BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 200910/127 X-Sequence-Number: 33326 Richard Huxton writes: > To prevent quoting insanity, I recommend the ARRAY[] constructor rather > than array literals. You do need the explicit typecasts. By the same token, you might want to use ROW() rather than composite-type literal syntax for the array elements. > Oh - and version 8.3 or higher for arrays of compound types. I think also that casting the array, rather than the individual rows, only works as of 8.4; ie in 8.3 you have to follow the first example: > SELECT print_array(ARRAY[ '(1,"abc")'::typ1, '(2,"def")'::typ1 ]); > SELECT print_array(ARRAY[ '(1,"abc")', '(2,"def")' ]::typ1[]); In this case there's not much real difference, but with a lot of array elements the individual casts get tedious. regards, tom lane