From: | Toby Tremayne <tobyt(at)toll(dot)com(dot)au> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | dynamic type create (was return setof record from function with dynamic query) |
Date: | 2002-12-20 01:52:34 |
Message-ID: | 52164126765.20021220125234@toll.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)toll(dot)com(dot)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-----
From | Date | Subject | |
---|---|---|---|
Next Message | Luke Van | 2002-12-20 04:47:27 | no more messages |
Previous Message | Bruce Momjian | 2002-12-20 01:34:11 | Re: trouble caused by change in 7.3 handling of '' |