Re: Table Valued Parameters - Mailing list pgsql-sql

From Tom Lane
Subject Re: Table Valued Parameters
Date
Msg-id 9984.1256399208@sss.pgh.pa.us
Whole thread Raw
In response to Re: Table Valued Parameters  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
Richard Huxton <dev@archonet.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


pgsql-sql by date:

Previous
From: Brian Modra
Date:
Subject: Re: Table Valued Parameters
Next
From: John
Date:
Subject: trouble with getting the field names