From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | Andrew Hall <andrewah(at)hotmail(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Table Valued Parameters |
Date: | 2009-10-24 15:46:48 |
Message-ID: | 9984.1256399208@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Richard Huxton <dev(at)archonet(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | John | 2009-10-26 23:41:49 | trouble with getting the field names |
Previous Message | Brian Modra | 2009-10-24 12:12:18 | Re: Table Valued Parameters |