On Fri, Oct 19, 2012 at 5:03 PM, Josh Berkus <j...@agliodbs.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers