Re: HINTing on UPDATE foo SET = ..;

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 = ..;
Date: 2014-11-22 17:02:16
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Marko Tiikkaja <marko(at)joh(dot)to> writes:
> 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.

Perhaps, but this hint is not much of an improvement:

> HINT: Target column references in UPDATE must not be qualified

because target column references *can* be "qualified", for example
if you have a composite column datatype you can assign directly to
one of its fields. (This ambiguity is exactly why we don't simply
allow the case.) So I don't think that "qualified" is a sufficiently
precise phrase to be helpful. Possibly something along the lines of

HINT: Do not qualify an UPDATE target column with the name of the table.

Also, the coding technique used here is poor, because the hint text
will not be exposed for translation. The usual pattern is

need_hint ? errhint("Message text here.") : 0

Also, as far as Peter's point goes, it would likely make sense to
issue this hint if the column basename is *either* the alias name
or the underlying table name.

regards, tom lane

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2014-11-22 17:34:09 Re: HINTing on UPDATE foo SET = ..;
Previous Message David G Johnston 2014-11-22 16:04:05 Re: some ideas from users