Re: BUG #15577: Query returns different results when executed multiple times

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: BUG #15577: Query returns different results when executed multiple times
Дата
Msg-id 87k1jdpniz.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: BUG #15577: Query returns different results when executedmultiple times  (Thomas Munro <thomas.munro@enterprisedb.com>)
Ответы Re: BUG #15577: Query returns different results when executedmultiple times  (Thomas Munro <thomas.munro@enterprisedb.com>)
Re: BUG #15577: Query returns different results when executedmultiple times  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-bugs
>>>>> "Thomas" == Thomas Munro <thomas.munro@enterprisedb.com> writes:

 Thomas> So it's not the reading of the tuple queue per se, but the
 Thomas> resulting visit to a higher part of the plan when the Gather
 Thomas> node emits a tuple. It can't be right that plan id 2 and plan
 Thomas> id 0 are both using paramno 0, can it? I'm not too familiar
 Thomas> with the planner code that allocates those but will go and poke
 Thomas> at it.

Looks like this isn't a new bug, either; I can reproduce it on 10.x.

So I think you're right to finger the planner's allocation of params as
the culprit. Looking at replace_nestloop_params_mutator, it's keeping a
list of nestloop params in root->curOuterParams (thus, globally to the
whole subquery being planned), and it assumes that if equal() is true
between the value of an existing nestloop param (which must be a Var)
and the Var for the one it's trying to create, then it's ok to use the
existing one.

But clearly this can't work if one param is referenced both inside and
outside a Gather, because while they will compare equal for Vars, they
won't actually have the same value thanks to rows coming in from
workers.

-- 
Andrew (irc:RhodiumToad)


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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: BUG #15577: Query returns different results when executedmultiple times
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: BUG #15577: Query returns different results when executedmultiple times