subplan resets wrong hashtable - Mailing list pgsql-hackers

From Justin Pryzby
Subject subplan resets wrong hashtable
Date
Msg-id 20200210032547.GA1412@telsasoft.com
Whole thread Raw
Responses Re: subplan resets wrong hashtable
List pgsql-hackers
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,

Added here:

commit 356687bd825e5ca7230d43c1bffe7a59ad2e77bd
Author: Andres Freund <andres@anarazel.de>
Date:   Sat Feb 9 00:35:57 2019 -0800

    Reset, not recreate, execGrouping.c style hashtables.



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Identifying user-created objects
Next
From: nuko yokohama
Date:
Subject: Re: Implementing Incremental View Maintenance