Re: Deprecating RULES - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: Deprecating RULES
Date
Msg-id 507C31B3.40803@krosing.net
Whole thread Raw
In response to Re: Deprecating RULES  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
On 10/15/2012 12:41 PM, Greg Stark wrote:
> On Mon, Oct 15, 2012 at 8:00 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>> Please can anyone show me the SQL for a rule that cannot be written as
>> a view or a trigger? I do not believe such a thing exists and I will
>> provide free beer to the first person that can prove me wrong.
> Being written as a view doesn't help you because views use rules. I
> repeat, the very fact that we need rules to implement views prove
> rules are necessary for some purposes.
>
We really don't *need* rules to implement views as proved by other
databases which do have views but don't have rules.

Rules were used for implementing views because they were already
there and that by constraining them to standard VIEW syntax we
could nicely cut back the footgunnyness of SELECT rules (by
disallowing the "bad" usage like replacing select by insert or doing
multiple selects instead of one). Some of that is still available when
you place a VIEW over a function, but then it is at least more explicit.

-----
Hannu



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: odd alter_generic regression failures
Next
From: Robert Haas
Date:
Subject: Re: Truncate if exists