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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: HINTing on UPDATE foo SET foo.bar = ..;
Дата
Msg-id 9691.1416675736@sss.pgh.pa.us
обсуждение исходный текст
Ответ на HINTing on UPDATE foo SET foo.bar = ..;  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: HINTing on UPDATE foo SET foo.bar = ..;  (Marko Tiikkaja <marko@joh.to>)
Список 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 по дате отправления:

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: some ideas from users
Следующее
От: Marko Tiikkaja
Дата:
Сообщение: Re: HINTing on UPDATE foo SET foo.bar = ..;