Re: Proposal: anonymous composite types for Table Functions (aka SRFs)

Поиск
Список
Период
Сортировка
От Zeugswetter Andreas SB SD
Тема Re: Proposal: anonymous composite types for Table Functions (aka SRFs)
Дата
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA4961E2D@m0114.s-mxs.net
обсуждение исходный текст
Ответ на Proposal: anonymous composite types for Table Functions (aka SRFs)  (Joe Conway <mail@joeconway.com>)
Список pgsql-hackers
> > 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: Proposal: anonymous composite types for Table Functions
Следующее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: Proposal: anonymous composite types for Table Functions (aka SRFs)