subplan resets wrong hashtable

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: subplan resets wrong hashtable
Date: 2020-02-10 03:25:47
Message-ID: 20200210032547.GA1412@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)anarazel(dot)de>
Date: Sat Feb 9 00:35:57 2019 -0800

Reset, not recreate, execGrouping.c style hashtables.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message nuko yokohama 2020-02-10 03:34:32 Re: Implementing Incremental View Maintenance
Previous Message Masahiko Sawada 2020-02-10 03:24:31 Re: Identifying user-created objects