Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Jim Nasby <jim(at)nasby(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules
Date: 2014-06-15 00:39:27
Message-ID: 20140615003927.GA18143@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-06-14 19:27:03 -0500, Jim Nasby wrote:
> On 6/14/14, 3:51 PM, Andres Freund wrote:
> >>Hm. But you might as well use a trigger, no? Is anyone likely to
> >>>actually be doing such a thing?
> >I don't think anybody is likely to do such a thing on an actual table,
> >but INSTEAD OF for views is pretty new. For a long time rules were the
> >the only way to implement updatable views (including any form of row
> >level security).
> >
> >>>It's conceivable that we could optimize the special case of NEW.*,
> >>>especially if it appears in the rule query's targetlist. But it's
> >>>trouble I don't really care to undertake ...
> >I think it's fine to just throw an error.
>
> If there was a showstopper to moving forward with rule support I think
> it'd be OK to throw our hands in the air, but that's not the case
> here.
>
> I'm in favor of doing the substitution, just like we do today with
> RULES, warts and all. We already warn people against using rules and
> that they're very difficult to get correct, so I don't think double
> eval of an expression should surprise anyone.

It makes a formerly correct/safe rule unsafe. That's a showstopper from
my POV.

There's *STILL* no proper warning against rules in the manual, btw.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2014-06-15 00:44:03 Re: Add CREATE support to event triggers
Previous Message Jim Nasby 2014-06-15 00:27:03 Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules