From: | "Carel Combrink" <s25291930(at)tuks(dot)co(dot)za> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "PostgreSQL Novice List" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Function Returning Table/Record |
Date: | 2010-09-01 07:05:01 |
Message-ID: | 20100901090501.76516by6dnn75ee5@student.up.ac.za |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Quoting "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> "Carel Combrink" <s25291930(at)tuks(dot)co(dot)za> writes:
>> I have a function that returns a subset of data from a specific table.
>> The function must return all the rows that are present in the parent
>> table.
>
>> Is there an easy way to create this function so that when the table
>> definition changes I don't need to change the function definition.
>> I know I can create the table to return RECORD but then when I call
>> the function I must specify the structure of the returned type.
>
> Can't you declare it as returning the table's rowtype?
>
> regards, tom lane
>
I have tried to do this with no success, using the ROWTYPE keyword.
After your response I have tried:
RETURNS SETOF table_name
And it correctly returns what I've wanted.
Thank you,
--
Carel Combrink
s25291930(at)tuks(dot)co(dot)za
This message and attachments are subject to a disclaimer. Please refer
to www.it.up.ac.za/documentation/governance/disclaimer/ for full
details. / Hierdie boodskap en aanhangsels is aan 'n vrywaringsklousule
onderhewig. Volledige besonderhede is by
www.it.up.ac.za/documentation/governance/disclaimer/ beskikbaar.
From | Date | Subject | |
---|---|---|---|
Next Message | Machiel Richards | 2010-09-01 08:54:18 | Postgresql security checks |
Previous Message | Bruce Momjian | 2010-08-31 15:46:38 | Re: PostgreSQL training |