Re: Passing arguments to views - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Passing arguments to views
Date
Msg-id 26844.1138983696@sss.pgh.pa.us
Whole thread Raw
In response to Re: Passing arguments to views  (Chris Campbell <chris@bignerdranch.com>)
Responses Re: Passing arguments to views
Re: Passing arguments to views
List 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 by date:

Previous
From: Chris Campbell
Date:
Subject: Re: Passing arguments to views
Next
From: Chris Campbell
Date:
Subject: Re: Passing arguments to views