Re: Proposal: anonymous composite types for Table Functions (aka SRFs) - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: Proposal: anonymous composite types for Table Functions (aka SRFs)
Date
Msg-id GNELIHDDFBOCMGBFGEFOIEFECDAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Proposal: anonymous composite types for Table Functions (aka SRFs)  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
> 3. Modify FROM clause grammer to accept something like:
>     SELECT * FROM my_func() AS mtf(colname1 type1, colname2 type1, ...)
> where mtf is the table alias, colname1, etc are the column names, and
> type1, etc are the column types.

...

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

Chris



pgsql-hackers by date:

Previous
From: Yuva Chandolu
Date:
Subject: savepoint and rollback queries in postgres
Next
From: Tatsuo Ishii
Date:
Subject: RESET SESSION AUTHORIZATION