Re: subplan resets wrong hashtable

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: subplan resets wrong hashtable
Дата
Msg-id 20200210040126.pxcrvq5lvxf7fjwi@alap3.anarazel.de
обсуждение исходный текст
Ответ на subplan resets wrong hashtable  (Justin Pryzby <pryzby@telsasoft.com>)
Ответы Re: subplan resets wrong hashtable  (Justin Pryzby <pryzby@telsasoft.com>)
Re: subplan resets wrong hashtable  (Justin Pryzby <pryzby@telsasoft.com>)
Список pgsql-hackers
Hi,

On 2020-02-09 21:25:47 -0600, Justin Pryzby wrote:
> I believe the 2nd hunk should reset node->hashnulls, rather than reset
> ->hashtable a 2nd time:
> 
> @@ -505,7 +505,10 @@ buildSubPlanHash(SubPlanState *node, ExprContext *econtext)
>         if (nbuckets < 1)
>                 nbuckets = 1;
>  
> -       node->hashtable = BuildTupleHashTable(node->parent,
> +       if (node->hashtable)
> +               ResetTupleHashTable(node->hashtable);
> +       else
> +               node->hashtable = BuildTupleHashTableExt(node->parent,
>                                                                                                  node->descRight,
>                                                                                                  ncols,
>                                                                                                  node->keyColIdx,
> ...
> 
> @@ -527,7 +531,11 @@ buildSubPlanHash(SubPlanState *node, ExprContext *econtext)
>                         if (nbuckets < 1)
>                                 nbuckets = 1;
>                 }
> -               node->hashnulls = BuildTupleHashTable(node->parent,
> +
> +               if (node->hashnulls)
> +                       ResetTupleHashTable(node->hashtable);
> +               else
> +                       node->hashnulls = BuildTupleHashTableExt(node->parent,
>
node->descRight,
>                                                                                                          ncols,
>
node->keyColIdx,

Ugh, that indeed looks wrong. Did you check whether it can actively
cause wrong query results? If so, did you do theoretically, or got to a
query returning wrong results?

- Andres



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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Postgres 32 bits client compilation fail. Win32 bits client is supported?
Следующее
От: Justin Pryzby
Дата:
Сообщение: Re: subplan resets wrong hashtable