Re: UPDATE ... WHERE (subselect on the same table)

Поиск
Список
Период
Сортировка
От Alexander M. Pravking
Тема Re: UPDATE ... WHERE (subselect on the same table)
Дата
Msg-id 20040629172849.GB73173@dyatel.antar.bryansk.ru
обсуждение исходный текст
Ответ на UPDATE ... WHERE (subselect on the same table)  ("Alexander M. Pravking" <fduch@antar.bryansk.ru>)
Список pgsql-sql
On Tue, Jun 29, 2004 at 12:49:55PM -0400, Tom Lane wrote:
> > So I have two questions:
> > Q1, cognitive. Why the alias for the updated table is restricted?
> 
> Because the SQL standard doesn't allow an alias there.  We've talked
> about allowing one anyway, but no one's gotten around to it.  AFAICS
> it would only be a marginal notational advantage, not allow you to
> express queries you can't express today.
> 
> > Q2, vital. Can I be sure that the syntax I used here will work
> > correctly, i.e. will the "test.name" always refer the column in outer
> > table, not inner (t2)?
> 
> Yes.  The alias *completely* hides the real name of that table
> reference, so "test" will never refer to "test t2".

As always, perfectly clear, thank you Tom :)

I already found in docs on SELECT:
When an alias is provided, it completely hides the actual name of the
table or table function;

/me should RTFM... (repeating hundred times)

-- 
Fduch M. Pravking


В списке pgsql-sql по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: FW: "=" operator vs. "IS"
Следующее
От: Tom Lane
Дата:
Сообщение: Re: UPDATE ... WHERE (subselect on the same table)