> 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.
Actually, I found myself wondering about RULEs and FDWs, for that
matter. There's not much synergy there now, but I can imagine RULEs
being used to do rewriting for funkier FDW setups, which would be hard
to do with TRIGGERs.
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?
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com