Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@2ndquadrant.com>
Cc: Jim Nasby <jim@nasby.net>, pgsql-hackers@postgresql.org
Date: 2014-06-17T23:09:12Z
Lists: pgsql-hackers
Attachments
- multi-assignment-2.patch (text/x-diff) patch
Andres Freund <andres@2ndquadrant.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