On 15 October 2012 11:41, Greg Stark <st...@mit.edu> wrote: > On Mon, Oct 15, 2012 at 8:00 AM, Simon Riggs <si...@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.
Well, the usual way that this proposal is phrased is that user-defined rules should be deprecated. Granted, that wasn't the case on this occasion, but it has been on many other occasions. It's not as if we there isn't a clear separation between what we all agree are "good rules" (that is, ON SELECT DO INSTEAD SELECT rules, which views are technically very simple wrappers of) and "bad rules" (that is, everything else). Humorous aside: I saw this comment within view.c, that dates from the Postgres95 days at the latest (but is probably older still): * This update consists of adding two new entries IN THE BEGINNING * of the range table (otherwise the rule system will die a slow, * horrible and painful death, and we do not want that now, do we?) I'm not sure that the authors' remarks about not wanting that should be taken at face value... -- Peter Geoghegan http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training and Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers