public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Fetter <[email protected]>
Subject: [PATCH v1] Add an ALL option to EXPLAIN
Date: Tue, 7 May 2019 00:26:29 -0700


which starts all boolean options at once.

diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml
index 385d10411f..ade3793c5f 100644
--- a/doc/src/sgml/ref/explain.sgml
+++ b/doc/src/sgml/ref/explain.sgml
@@ -43,6 +43,7 @@ EXPLAIN [ ANALYZE ] [ VERBOSE ] <replaceable class="parameter">statement</replac
     BUFFERS [ <replaceable class="parameter">boolean</replaceable> ]
     TIMING [ <replaceable class="parameter">boolean</replaceable> ]
     SUMMARY [ <replaceable class="parameter">boolean</replaceable> ]
+    ALL [ <replaceable class="parameter">boolean</replaceable> ]
     FORMAT { TEXT | XML | JSON | YAML }
 </synopsis>
  </refsynopsisdiv>
@@ -224,6 +225,16 @@ ROLLBACK;
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term><literal>ALL</literal></term>
+    <listitem>
+     <para>
+      Include (or exclude) all of the above settings before examining the rest
+      of the options. It defaults to <literal>FALSE</literal>.
+     </para>
+    </listitem>
+   </varlistentry>
+
    <varlistentry>
     <term><literal>FORMAT</literal></term>
     <listitem>
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index a6c6de78f1..966f4566c7 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -151,6 +151,26 @@ ExplainQuery(ParseState *pstate, ExplainStmt *stmt, const char *queryString,
 	bool		summary_set = false;
 
 	/* Parse options list. */
+	/* First, see whether ALL is set */
+	foreach(lc, stmt->options)
+	{
+		DefElem	   *opt = (DefElem *) lfirst(lc);
+
+		if (strcmp(opt->defname, "all") == 0)
+		{
+			es->analyze = defGetBoolean(opt);
+			es->verbose = defGetBoolean(opt);
+			es->costs = defGetBoolean(opt);
+			es->buffers = defGetBoolean(opt);
+			es->settings = defGetBoolean(opt);
+			timing_set = true;
+			es->timing = defGetBoolean(opt);
+			summary_set = true;
+			es->timing = defGetBoolean(opt);
+		}
+	}
+
+	/* If you add another boolean option here, remember to add it above, too */
 	foreach(lc, stmt->options)
 	{
 		DefElem    *opt = (DefElem *) lfirst(lc);


view thread (26+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v1] Add an ALL option to EXPLAIN
  In-Reply-To: <no-message-id-1883093@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox