Re: Deprecating RULES

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Deprecating RULES
Date: 2012-10-17 18:13:13
Message-ID: 507EF539.3060202@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg,

> Warning: RULES are tricky to use correctly. They rewrite the original
> query into a new query before it is run and it is very hard to
> correctly anticipate and rewrite every possible input query into the
> desired result. There are also unexpected interactions with other
> components when RULES do something unexpected such as rewrite a single
> query to return two result sets.
>
> For most applications it's much simpler and more predictable to use
> TRIGGERs. ROW level triggers are evaluated for each row the original
> query is about to process (or has just finished processing) and this
> makes them much easier to follow. Statement level TRIGGERs can be used
> for audit logs and similar operations which need to run once per
> statement.

This is excellent. However, if we are actually considerting deprecating
them, we should add the sentence "RULEs may be deprecated in a future
release of PostgreSQL."

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-10-17 18:19:24 Re: Deprecating RULES
Previous Message Peter Geoghegan 2012-10-17 18:07:04 Re: Deprecating RULES