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

From Marko Tiikkaja
Subject HINTing on UPDATE foo SET foo.bar = ..;
Date
Msg-id 547007C6.8040204@joh.to
Whole thread Raw
Responses Re: HINTing on UPDATE foo SET foo.bar = ..;  (Peter Geoghegan <pg@heroku.com>)
Re: HINTing on UPDATE foo SET foo.bar = ..;  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

A common mistake is to try and qualify column references on the LHS of
SET in UPDATE.  The error message can be a bit cryptic at times, too.
I've attached a patch to try and improve the situation a bit:

=# create table foo(bar int);
CREATE TABLE

=# update foo set foo.bar = 1;
ERROR:  column "foo" of relation "foo" does not exist
LINE 1: update foo set foo.bar = 1;
                        ^
HINT:  Target column references in UPDATE must not be qualified

=# update foo set notfoo.bar = 1; -- no hint
ERROR:  column "notfoo" of relation "foo" does not exist
LINE 1: update foo set notfoo.bar = 1;
                        ^

=# update foo set foo.bar[1] = 1;
ERROR:  column "foo" of relation "foo" does not exist
LINE 1: update foo set foo.bar[1] = 1;
                        ^
HINT:  Target column references in UPDATE must not be qualified


I'll add this to the next CF, but feel free to bash it before that.


.marko

Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: How to use brin indexes?
Next
From: Peter Geoghegan
Date:
Subject: Re: HINTing on UPDATE foo SET foo.bar = ..;