Re: Passing arguments to views

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Passing arguments to views
Дата
Msg-id 26844.1138983696@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Passing arguments to views  (Chris Campbell <chris@bignerdranch.com>)
Ответы Re: Passing arguments to views  (Chris Campbell <chris@bignerdranch.com>)
Re: Passing arguments to views  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
Chris Campbell <chris@bignerdranch.com> writes:
> I want to beef up rules versus beefing up functions.

Martijn didn't present a very convincing argument why this is a bad
idea, but I agree with him that it is.  The problem to me is that a
"view with arguments" is fundamentally wrong --- a view is a virtual
table and there is no such thing as a table with arguments.  The whole
notion distorts the relational data model beyond recognition.

The SRF concept captures what you want a whole lot better.  If the
implementation isn't up to snuff, we should improve it, not warp other
pieces of the system.

Martijn mentioned the idea of inlining SQL functions that return sets
--- this is something I've toyed with too, but not got round to looking
at seriously.  AFAICS it would accomplish everything that you could do
with parameters in ON SELECT rules, considering the existing
restrictions on what can be in an ON SELECT rule.  And it wouldn't
require any new concepts at all, just a few(?) pages of code.

As for the dependency issue, one man's bug is another man's feature.
I think the fact that we don't track the internal dependencies of
functions is not all bad.  We've certainly seen plenty of complaints
about how you can't easily change tables that a view is depending on
because the view dependencies block it...
        regards, tom lane


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

Предыдущее
От: Chris Campbell
Дата:
Сообщение: Re: Passing arguments to views
Следующее
От: Chris Campbell
Дата:
Сообщение: Re: Passing arguments to views