Re: Removing unneeded self joins

Поиск
Список
Период
Сортировка
От Andrei Lepikhov
Тема Re: Removing unneeded self joins
Дата
Msg-id 0c5f461f-e26f-4fd9-9700-91b0e9c38fd6@postgrespro.ru
обсуждение исходный текст
Ответ на Re: Removing unneeded self joins  (Alexander Lakhin <exclusion@gmail.com>)
Ответы Re: Removing unneeded self joins  (Alexander Lakhin <exclusion@gmail.com>)
Список pgsql-hackers
On 29/12/2023 12:00, Alexander Lakhin wrote:
> Hi Alexander,
> 
> 23.10.2023 14:29, Alexander Korotkov wrote:
>> Fixed all of the above. Thank you for catching this!
> 
> I've discovered that starting from d3d55ce57 the following query:
> CREATE TABLE t(a int PRIMARY KEY);
> 
> WITH tt AS (SELECT * FROM t)
> UPDATE t SET a = tt.a + 1 FROM tt
> WHERE tt.a = t.a RETURNING t.a;
> 
> triggers an error "variable not found in subplan target lists".
> (Commits 8a8ed916f and b5fb6736e don't fix this, unfortunately.)

Thanks for the report!
The problem is with the resultRelation field. We forget to replace the 
relid here.
Could you check your issue with the patch in the attachment? Does it 
resolve this case?

-- 
regards,
Andrei Lepikhov
Postgres Professional

Вложения

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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Revise the Asserts added to bimapset manipulation functions
Следующее
От: "Andrey M. Borodin"
Дата:
Сообщение: Re: Transaction timeout