dynamic type create (was return setof record from function with dynamic query) - Mailing list pgsql-general

From Toby Tremayne
Subject dynamic type create (was return setof record from function with dynamic query)
Date
Msg-id 52164126765.20021220125234@toll.com.au
Whole thread Raw
In response to Re: return setof record from function with dynamic query  (Masaru Sugawara <rk73@sea.plala.or.jp>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: MD5

Hi Masaru,

   thanks for that - using Grant's instructions I created a new type
   and set it up that way - works beautifully.

   New question - is there any way to dynamically create a type?  IE
   build a list of column names for a new type from the results of a
   select?

Toby

Thursday, December 19, 2002, 2:32:29 AM, you wrote:

MS> On Wed, 18 Dec 2002 17:18:56 +1100
MS> Toby Tremayne <tobyt@toll.com.au> wrote:

>>    ERROR:  A column definition list is required for functions returning RECORD
>>
>>    I'd really appreciate it if someone could show me how to pass back
>>    a set of records please???
>>
>> Toby
>>
>> CREATE FUNCTION poptions (INTEGER)
>> RETURNS setof record AS '
>> DECLARE
>>         -- parameters
>>         p_author_id ALIAS FOR $1;
>>
>>         -- local variables
>>         row_data poem_option_def%ROWTYPE;
>>         newrows record;


MS> Possibly, Grant's advice will help you. Maybe around the description
MS> of CREATE TYPE.

MS> http://archives.postgresql.org/pgsql-hackers/2002-09/msg01741.php



MS> Regards,
MS> Masaru Sugawara








 ---------------------------------------

             Life is poetry -
               write it in your own words.

 ---------------------------------------

Toby Tremayne
Technical Team Lead
Code Poet and Zen Master of the Heavy Sleep
Toll Solutions
154 Moray St
Sth Melbourne
VIC 3205
+61 3 9697 2317
0416 048 090
ICQ:  13107913

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQCVAwUAPgJ34kYhrxxXvPlFAQGcMAP+Mf0i2Votx1Ca80xpY1duQvva8BzqOPL8
alF4qZd7bvc+j09XDQc+z5W1r/DAYG4oDsb1HT+R/oWkFz8+crXw94T/nCfOS9bb
lYkUPZ+R5tXlsHEwiTQ1B/mJxwgp1VWDxDHzCG4hJyjBTRNoJ5C6VcJqZtx/P2cU
Wl0jEand1/0=
=jGX0
-----END PGP SIGNATURE-----


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: trouble caused by change in 7.3 handling of ''
Next
From: Luke Van
Date:
Subject: no more messages