> > Now when creating a function you can do:
> >    CREATE FUNCTION foo(text) RETURNS setof RECORD ...
> >
> > And when using it you can do, e.g.:
> >    SELECT * from foo(sqlstmt) AS (f1 int, f2 text, f3 timestamp)
> 
> Why is there the requirement to declare the type at SELECT 
> time at all?  Why
> not just take what you get when you run the function?

Yea, that would imho be ultra cool, but I guess the parser/planner must already 
know the expected column names and types to resolve conflicts, do a reasonable 
plan and use the correct type conversions.

Maybe the AS (...) could be optional, and if left out, the executor would need 
to abort iff duplicate colnames (from a joined table) or non binary compatible 
conversions would be involved. A "select * from func();" would then always work,
but if you add "where x=5" the executor might need to abort.
Looks like a lot of work though.

Andreas  

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to