Re: HINTing on UPDATE foo SET foo.bar = ..;

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: "pgsql-hackers >> PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: HINTing on UPDATE foo SET foo.bar = ..;
Date: 2014-11-22 04:11:20
Message-ID: CAM3SWZTjOUO=tv8SnRxD=8CAcE+Wz2hVj0vn-c0J3K+7tPMW3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 21, 2014 at 7:49 PM, Marko Tiikkaja <marko(at)joh(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-11-22 04:22:06 Re: Turning recovery.conf into GUCs
Previous Message Marko Tiikkaja 2014-11-22 03:49:26 HINTing on UPDATE foo SET foo.bar = ..;