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

From Tom Lane
Subject Re: HINTing on UPDATE foo SET foo.bar = ..;
Date
Msg-id 9691.1416675736@sss.pgh.pa.us
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
Marko Tiikkaja <marko@joh.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



pgsql-hackers by date:

Previous
From: David G Johnston
Date:
Subject: Re: some ideas from users
Next
From: Marko Tiikkaja
Date:
Subject: Re: HINTing on UPDATE foo SET foo.bar = ..;