Re: Deprecating RULES

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Daniel Farina <daniel(at)heroku(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Deprecating RULES
Date: 2012-10-22 11:53:30
Message-ID: CA+TgmoZt4OFRawxFJOW3dhT7fn2j8t=12xJqm0hLqT+e_ZtJUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 19, 2012 at 5:03 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>> That's a pretty neat one-liner. However... in my view, the real cost
>> of rules is that they are hard to support as we add new features to
>> SQL. I believe we already decided to punt on making them work with
>> CTEs... and maybe one other case? I don't really remember the details
>> any more, but presumably this will come up again with MERGE, and
>> perhaps other cases...
>
> Unless the easiest way to implement MERGE is to extend RULEs.

The problems with MERGE are mostly around concurrency, as far as I can
tell. I can't see why RULEs would have anything to do with it -
except that I don't see how MERGE can sanely support rules, and even
if we find a way to make it do that, anyone already using RULEs will
need to adjust them to support MERGE. I'm not sure I have a horribly
well-thought-out position on the underlying issue here - I'm kind of
vacillating back and forth - but I do think one of the problems with
RULEs is that they are too tied to particular command names. Adding
any new commands that can select or modify data - be it MERGE, UPSERT,
or whatever - is going to cause trouble both for implementors and for
people relying on the feature.

> For example, imagine you have a series of CSV FDWs which relate to
> segments of a postgres log. You want to query them like they were one
> table. How would you use triggers to do that?

You wouldn't. You'd use a view, which of course is the only kind of
rules that are not being proposed for deprecation.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-10-22 12:57:31 Re: Deprecating RULES
Previous Message Marko Tiikkaja 2012-10-22 11:33:42 Re: pg_dump --split patch