From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules |
Date: | 2014-06-14 20:51:58 |
Message-ID: | 20140614205158.GG6763@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2014-06-14 16:44:10 -0400, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2014-06-14 15:48:52 -0400, Tom Lane wrote:
> >> Well, it wouldn't be "unsafe" (barring volatile functions in the UPDATE,
> >> which are unsafe already). It might be slow, but that's probably better
> >> than failing.
>
> > I forgot the details, but IIRC it's possible to write a ON UPDATE ...
> > DO INSTEAD rule that's safe wrt multiple evaluations today by calling a
> > function passing in the old pkey and NEW. At least I believed so at some
> > point in the past :P
>
> 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.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2014-06-14 20:53:12 | Re: crash with assertions and WAL_DEBUG |
Previous Message | Alvaro Herrera | 2014-06-14 20:51:06 | crash with assertions and WAL_DEBUG |