Skip site navigation (1) Skip section navigation (2)

Re: Function Returning Table/Record

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Carel Combrink" <s25291930(at)tuks(dot)co(dot)za>
Cc: "PostgreSQL Novice List" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Function Returning Table/Record
Date: 2010-08-31 14:21:58
Message-ID: 2232.1283264518@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
"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

In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2010-08-31 14:26:50
Subject: Re: Django + Postgressql
Previous:From: Carel CombrinkDate: 2010-08-31 14:16:46
Subject: Reduce Calculations in SELECT

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group