pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: Andrew Hall <andrewah@hotmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Table Valued Parameters
Date: Sat, 24 Oct 2009 11:46:48 -0400
Message-ID: <9984.1256399208@sss.pgh.pa.us> (raw)
In-Reply-To: <4AE2EC83.6060908@archonet.com>
References: <COL122-W14509AEC755F5710A3CA19CDBD0@phx.gbl>
	<4AE2EC83.6060908@archonet.com>

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



view thread (8+ messages)

Message-ID: <9984.1256399208@sss.pgh.pa.us>
Permalink:  ../9984.1256399208@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9984.1256399208@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dev@archonet.com, andrewah@hotmail.com
  Subject: Re: Table Valued Parameters
  In-Reply-To: <9984.1256399208@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox