Re: DELETE ... USING LATERAL

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: DELETE ... USING LATERAL
Дата
Msg-id 3998065.1633369719@sss.pgh.pa.us
обсуждение исходный текст
Ответ на DELETE ... USING LATERAL  (Nikhil Benesch <nikhil.benesch@gmail.com>)
Ответы Re: DELETE ... USING LATERAL  (Nikhil Benesch <nikhil.benesch@gmail.com>)
Список pgsql-general
Nikhil Benesch <nikhil.benesch@gmail.com> writes:
> Is it intentional that LATERAL elements in a USING clause of a DELETE
> statement can't reference the table declared in the FROM clause?

Hmm ... doesn't work for UPDATE, either.

My mental model of these things is that the target table is cross-joined
to the additional tables as though by a comma in FROM, so that what
you have here ought to work much like

select * from int_arrays, jsonb_array_each(int_array) _ (val)
where val::integer > 1;

Clearly it's not doing so as far as the LATERAL scoping is concerned.
Maybe we are adding the target table to the query after the additional
tables, not before them?

Not sure I'd call this a bug exactly, but maybe there's room for
improvement.  Or maybe there is an actual semantic issue that
I'm not seeing right away.

            regards, tom lane



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

Предыдущее
От: Israel Brewster
Дата:
Сообщение: Re: Growth planning
Следующее
От: Nikhil Benesch
Дата:
Сообщение: Re: DELETE ... USING LATERAL