Re: Deprecating RULES

From: Hannu Krosing <hannu(at)krosing(dot)net>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Peter Geoghegan <peter(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Deprecating RULES
Date: 2012-10-15 15:54:27
Message-ID: 507C31B3.40803@krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/15/2012 12:41 PM, Greg Stark wrote:
> On Mon, Oct 15, 2012 at 8:00 AM, Simon Riggs <simon(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-10-15 15:57:18 Re: Truncate if exists
Previous Message Tom Lane 2012-10-15 15:29:25 Re: odd alter_generic regression failures