Function Returning Table/Record

From: "Carel Combrink" <s25291930(at)tuks(dot)co(dot)za>
To: "PostgreSQL Novice List" <pgsql-novice(at)postgresql(dot)org>
Subject: Function Returning Table/Record
Date: 2010-08-31 13:36:25
Message-ID: 20100831153625.57056tm0nsi47909@student.up.ac.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

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.
Eg. SELECT * FROM my_func(args) AS foo(col type, ...);

There are a lot of columns so this is not a very practical solution.

Isn't there a shorter/better/easier way to do this?

--
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.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Robert Dean 2010-08-31 13:41:32 Django + Postgressql
Previous Message A. Kretschmer 2010-08-31 06:28:31 Re: Running totals