Function Returning Table/Record - Mailing list pgsql-novice

From Carel Combrink
Subject Function Returning Table/Record
Date
Msg-id 20100831153625.57056tm0nsi47909@student.up.ac.za
Whole thread Raw
Responses Re: Function Returning Table/Record  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@tuks.co.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.


pgsql-novice by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Running totals
Next
From: Robert Dean
Date:
Subject: Django + Postgressql