Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 53abb1e

Browse files
committed
Fix newly introduced issue in EXPLAIN for Materialize nodes
The code added in 1eff827 was lacking a check to see if the tuplestore had been created. In nodeMaterial.c this is done by ExecMaterial() rather than by ExecInitMaterial(), so the tuplestore won't be created unless the node has been executed at least once, as demonstrated by Alexander in his report. Here we skip showing any of the new EXPLAIN ANALYZE information when the Materialize node has not been executed. Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/fe7fc8fb-86e5-ecb0-3cb2-dd2c9a6c482f@gmail.com
1 parent 1850184 commit 53abb1e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/backend/commands/explain.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -3333,14 +3333,17 @@ show_hash_info(HashState *hashstate, ExplainState *es)
33333333
static void
33343334
show_material_info(MaterialState *mstate, ExplainState *es)
33353335
{
3336-
Tuplestorestate *tupstore;
3336+
Tuplestorestate *tupstore = mstate->tuplestorestate;
33373337
const char *storageType;
33383338
int64 spaceUsedKB;
33393339

3340-
if (!es->analyze)
3340+
/*
3341+
* Nothing to show if ANALYZE option wasn't used or if execution didn't
3342+
* get as far as creating the tuplestore.
3343+
*/
3344+
if (!es->analyze || tupstore == NULL)
33413345
return;
33423346

3343-
tupstore = mstate->tuplestorestate;
33443347
storageType = tuplestore_storage_type_name(tupstore);
33453348
spaceUsedKB = BYTES_TO_KILOBYTES(tuplestore_space_used(tupstore));
33463349

0 commit comments

Comments
 (0)