diff options
author | Bruce Momjian <bruce@momjian.us> | 1996-12-29 19:31:16 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1996-12-29 19:31:16 +0000 |
commit | 765dd2a4c0376aad041aedfbf1aca8bf00bb6856 (patch) | |
tree | 7bf8a0727b4f0b8d285ffb8525bef616991ff374 /src/backend/commands/explain.c | |
parent | bf6fdeebb5a4d9d864caf0ff91d8d1789b3522f0 (diff) | |
download | postgresql-765dd2a4c0376aad041aedfbf1aca8bf00bb6856.tar.gz postgresql-765dd2a4c0376aad041aedfbf1aca8bf00bb6856.zip |
explain change
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 5eabda8570b..2dbc6938c3b 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.6 1996/12/29 00:53:20 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.7 1996/12/29 19:30:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,8 +27,8 @@ typedef struct ExplainState { /* options */ - int printCost; /* print cost */ - int printNodes; /* do nodeToString() instead */ + bool printCost; /* print cost */ + bool printNodes; /* do nodeToString() instead */ /* other states */ List *rtable; /* range table */ } ExplainState; @@ -69,18 +69,25 @@ ExplainQuery(Query *query, List *options, CommandDest dest) memset(es, 0, sizeof(ExplainState)); /* parse options */ - es->printCost = 1; /* default */ while (options) { char *ostr = strVal(lfirst(options)); if (!strcasecmp(ostr, "cost")) - es->printCost = 1; - else if (!strcasecmp(ostr, "full")) - es->printNodes = 1; + es->printCost = true; + else if (!strcasecmp(ostr, "plan")) + es->printNodes = true; + else if (!strcasecmp(ostr, "full")) { + es->printCost = true; + es->printNodes = true; + } else elog(WARN, "Unknown EXPLAIN option: %s", ostr); options = lnext(options); } + + if (!es->printCost && !es->printNodes) + es->printCost = true; /* default */ + es->rtable = query->rtable; if (es->printNodes) |