mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Extend EXPLAIN to allow generic options to be specified.
The original syntax made it difficult to add options without making them into reserved words. This change parenthesizes the options to avoid that problem, and makes provision for an explicit (and perhaps non-Boolean) value for each option. The original syntax is still supported, but only for the two original options ANALYZE and VERBOSE. As a test case, add a COSTS option that can suppress the planner cost estimates. This may be useful for including EXPLAIN output in the regression tests, which are otherwise unable to cope with cross-platform variations in cost estimates. Robert Haas
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.104 2009/04/04 21:12:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.105 2009/07/26 23:34:17 tgl Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The "DefineFoo" routines take the parse tree and pick out the
|
||||
@ -133,7 +133,7 @@ defGetBoolean(DefElem *def)
|
||||
return true;
|
||||
|
||||
/*
|
||||
* Allow 0, 1, "true", "false"
|
||||
* Allow 0, 1, "true", "false", "on", "off"
|
||||
*/
|
||||
switch (nodeTag(def->arg))
|
||||
{
|
||||
@ -153,11 +153,18 @@ defGetBoolean(DefElem *def)
|
||||
{
|
||||
char *sval = defGetString(def);
|
||||
|
||||
/*
|
||||
* The set of strings accepted here should match up with
|
||||
* the grammar's opt_boolean production.
|
||||
*/
|
||||
if (pg_strcasecmp(sval, "true") == 0)
|
||||
return true;
|
||||
if (pg_strcasecmp(sval, "false") == 0)
|
||||
return false;
|
||||
|
||||
if (pg_strcasecmp(sval, "on") == 0)
|
||||
return true;
|
||||
if (pg_strcasecmp(sval, "off") == 0)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user