Re: Proposal: anonymous composite types for Table Functions - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Proposal: anonymous composite types for Table Functions
Date
Msg-id 3D3FA220.7000707@joeconway.com
Whole thread Raw
In response to Re: Proposal: anonymous composite types for Table Functions (aka SRFs)  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Responses Re: Proposal: anonymous composite types for Table Functions (aka SRFs)  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
Christopher Kings-Lynne wrote:
> 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?

The column names and types are determined in the parser, and used in the 
planner, optimizer, and executor. I'm not sure how the backend could 
plan a join or a where criteria otherwise.

Remember that the function has to look just like a table or a subselect 
(i.e a RangeVar). With a table, the column names and types are 
predefined. With a subselect, parsing it yields the same information. 
With a table function, we need some way of providing it -- i.e. either 
with a predefined type, or now with a definition right in the FROM clause.

Joe





pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: RESET SESSION AUTHORIZATION
Next
From: "Zeugswetter Andreas SB SD"
Date:
Subject: Re: Proposal: anonymous composite types for Table Functions (aka SRFs)