Skip to content

Commit 3a02ccf

Browse files
committed
Change EXPLAIN options to just use VERBOSE.
1 parent b00c2c1 commit 3a02ccf

File tree

6 files changed

+19
-40
lines changed

6 files changed

+19
-40
lines changed

src/backend/commands/explain.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.7 1996/12/29 19:30:55 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.8 1997/01/16 14:55:58 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -41,7 +41,7 @@ static char *Explain_PlanToString(Plan *plan, ExplainState *es);
4141
*
4242
*/
4343
void
44-
ExplainQuery(Query *query, List *options, CommandDest dest)
44+
ExplainQuery(Query *query, bool verbose, CommandDest dest)
4545
{
4646
char *s = NULL, *s2;
4747
Plan *plan;
@@ -68,25 +68,10 @@ ExplainQuery(Query *query, List *options, CommandDest dest)
6868
es = (ExplainState*)malloc(sizeof(ExplainState));
6969
memset(es, 0, sizeof(ExplainState));
7070

71-
/* parse options */
72-
while (options) {
73-
char *ostr = strVal(lfirst(options));
74-
if (!strcasecmp(ostr, "cost"))
75-
es->printCost = true;
76-
else if (!strcasecmp(ostr, "plan"))
77-
es->printNodes = true;
78-
else if (!strcasecmp(ostr, "full")) {
79-
es->printCost = true;
80-
es->printNodes = true;
81-
}
82-
else
83-
elog(WARN, "Unknown EXPLAIN option: %s", ostr);
84-
85-
options = lnext(options);
86-
}
71+
es->printCost = true; /* default */
8772

88-
if (!es->printCost && !es->printNodes)
89-
es->printCost = true; /* default */
73+
if (verbose)
74+
es->printNodes = true;
9075

9176
es->rtable = query->rtable;
9277

src/backend/parser/gram.y

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.24 1997/01/13 03:44:18 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.25 1997/01/16 14:56:05 momjian Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -131,7 +131,7 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
131131
sort_clause, sortby_list, index_params,
132132
name_list, from_clause, from_list, opt_array_bounds, nest_array_bounds,
133133
expr_list, attrs, res_target_list, res_target_list2,
134-
def_list, opt_indirection, group_clause, groupby_list, explain_options
134+
def_list, opt_indirection, group_clause, groupby_list
135135

136136
%type <boolean> opt_inh_star, opt_binary, opt_instead, opt_with_copy,
137137
index_opt_unique, opt_verbose
@@ -1227,21 +1227,15 @@ opt_verbose: VERBOSE { $$ = TRUE; }
12271227
*
12281228
*****************************************************************************/
12291229

1230-
ExplainStmt: EXPLAIN explain_options OptimizableStmt
1230+
ExplainStmt: EXPLAIN opt_verbose OptimizableStmt
12311231
{
12321232
ExplainStmt *n = makeNode(ExplainStmt);
1233+
n->verbose = $2;
12331234
n->query = (Query*)$3;
1234-
n->options = $2;
12351235
$$ = (Node *)n;
12361236
}
12371237
;
12381238

1239-
explain_options: WITH name_list
1240-
{ $$ = $2; }
1241-
| /*EMPTY*/
1242-
{ $$ = NIL; }
1243-
;
1244-
12451239
/*****************************************************************************
12461240
* *
12471241
* Optimizable Stmts: *

src/backend/tcop/utility.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.10 1997/01/13 03:44:38 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.11 1997/01/16 14:56:21 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -591,7 +591,7 @@ ProcessUtility(Node *parsetree,
591591
commandTag = "EXPLAIN";
592592
CHECK_IF_ABORTED();
593593

594-
ExplainQuery(stmt->query, stmt->options, dest);
594+
ExplainQuery(stmt->query, stmt->verbose, dest);
595595
}
596596
break;
597597

src/include/commands/explain.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
*
66
* Copyright (c) 1994-5, Regents of the University of California
77
*
8-
* $Id: explain.h,v 1.1 1996/08/28 07:21:47 scrappy Exp $
8+
* $Id: explain.h,v 1.2 1997/01/16 14:56:34 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
1212
#ifndef EXPLAIN_H
1313
#define EXPLAIN_H
1414

15-
extern void ExplainQuery(Query *query, List *options, CommandDest dest);
15+
extern void ExplainQuery(Query *query, bool verbose, CommandDest dest);
1616

1717
#endif /* EXPLAIN_H*/

src/include/nodes/parsenodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: parsenodes.h,v 1.9 1997/01/13 03:45:02 momjian Exp $
9+
* $Id: parsenodes.h,v 1.10 1997/01/16 14:56:45 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -408,7 +408,7 @@ typedef struct VacuumStmt {
408408
typedef struct ExplainStmt {
409409
NodeTag type;
410410
Query *query; /* the query */
411-
List *options;
411+
bool verbose; /* print plan info */
412412
} ExplainStmt;
413413

414414

src/man/explain.l

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/explain.l,v 1.3 1996/12/29 19:31:16 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/explain.l,v 1.4 1997/01/16 14:56:59 momjian Exp $
44
.TH EXPLAIN SQL 11/05/95 PostgreSQL PostgreSQL
55
.SH NAME
66
explain \(em explains statement execution details
77
.SH SYNOPSIS
88
.nf
9-
\fBexplain [with\fP \fB{cost|plan|full}]\fR query
9+
\fBexplain [verbose]\fR query
1010
.fi
1111
.SH DESCRIPTION
1212
This command outputs details about the supplied query. The default
13-
output is the computed query cost. \f2plan\f1 displays the full query
14-
plan. \f2full\f1 display both query plan and query cost.
13+
output is the computed query cost. \f2verbose\f1 displays the full query
14+
plan and cost.
1515
.PP
1616
The query cost and plan can be affected by running vacuum.
1717

0 commit comments

Comments
 (0)