Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 53abb1e

Browse filesBrowse 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
Copy full SHA for 53abb1e

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed

‎src/backend/commands/explain.c

Copy file name to clipboardExpand all lines: src/backend/commands/explain.c
+6-3Lines changed: 6 additions & 3 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.