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

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

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2014-06-14 19:27:03 -0500, Jim Nasby wrote:
>> 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.

Andres' objection has some merit, and it doesn't seem like very many
people are concerned about throwing errors for new constructs if it's hard
to make them work with rules. So I've updated the patch to throw an error
for now. We can always revisit it later if someone has a good idea about
how to implement it.

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

Not sure what you want for a "proper warning", but I put in a <caution>
that I think mentions the known gotchas.

This patch is now complete as far as I'm concerned. If there are not
objections I'll be committing it before long.

regards, tom lane

Attachment Content-Type Size
multi-assignment-2.patch text/x-diff 79.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-06-17 23:09:22 Re: Atomics hardware support table & supported architectures
Previous Message Bruce Momjian 2014-06-17 23:01:38 Re: pg_control is missing a field for LOBLKSIZE