Re: HINTing on UPDATE foo SET foo.bar = ..; - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: HINTing on UPDATE foo SET foo.bar = ..;
Date
Msg-id CAM3SWZTjOUO=tv8SnRxD=8CAcE+Wz2hVj0vn-c0J3K+7tPMW3g@mail.gmail.com
Whole thread Raw
In response to HINTing on UPDATE foo SET foo.bar = ..;  (Marko Tiikkaja <marko@joh.to>)
Responses Re: HINTing on UPDATE foo SET foo.bar = ..;  (Marko Tiikkaja <marko@joh.to>)
List pgsql-hackers
On Fri, Nov 21, 2014 at 7:49 PM, Marko Tiikkaja <marko@joh.to> wrote:
> A common mistake is to try and qualify column references on the LHS of SET
> in UPDATE.

I think that this is a good idea, but as written the patch doesn't
handle aliases correctly:

postgres=# create table foo (val text);
CREATE TABLE
postgres=# update foo f set val = 'bar' where f.val != 'fd';
UPDATE 0
postgres=# update foo f set f.val = 'bar' where f.val != 'fd';
ERROR:  42703: column "f" of relation "foo" does not exist
LINE 1: update foo f set f.val = 'bar' where f.val != 'fd';                        ^
LOCATION:  transformUpdateStmt, analyze.c:2015

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: HINTing on UPDATE foo SET foo.bar = ..;
Next
From: Amit Kapila
Date:
Subject: Re: Turning recovery.conf into GUCs