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

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: "pgsql-hackers >> PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: HINTing on UPDATE foo SET foo.bar = ..;
Date: 2014-11-22 03:49:26
Message-ID: 547007C6.8040204@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
update_qlf_hint.v1.patch text/plain 1.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-11-22 04:11:20 Re: HINTing on UPDATE foo SET foo.bar = ..;
Previous Message Alvaro Herrera 2014-11-22 02:29:04 Re: How to use brin indexes?