Re: AW: functions returning records - Mailing list pgsql-hackers

From Reinoud van Leeuwen
Subject Re: AW: functions returning records
Date
Msg-id 5148.194.109.0.126.993632203.squirrel@webmail.xs4all.nl
Whole thread Raw
In response to AW: functions returning records  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
Responses Re: AW: functions returning records  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-hackers
> 
>>  For the result from foo() you must somewhere define attributes
>>  (names). 
>> Where? In CREATE FUNCTION statement? Possible must be:
>> 
>>  select name1, name2 from foo() where name1 > 10;
> 
> Yes, optimal would imho also be if the foo() somehow had access to the
> where restriction, so it could only produce output, that the
> higher level is interested in, very cool. This would be extremely 
> useful for me. Very hard to implement, or even find an appropriate 
> interface for though.

You could easily implement it *in* the function foo IMHO. Since the 
function does some black magic to create the result set to begin with, you 
can change it to use parameters:

select name1, name2 from foo(10, NULL, NULL) where name1 > 10;



pgsql-hackers by date:

Previous
From: Zeugswetter Andreas SB
Date:
Subject: AW: functions returning records
Next
From: Zeugswetter Andreas SB
Date:
Subject: AW: Non-trivial rewriting sql query