summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/define.c21
-rw-r--r--src/backend/commands/functioncmds.c7
-rw-r--r--src/backend/commands/operatorcmds.c6
-rw-r--r--src/backend/commands/typecmds.c4
4 files changed, 29 insertions, 9 deletions
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index 19f14879a0e..e4a62b77308 100644
--- a/src/backend/commands/define.c
+++ b/src/backend/commands/define.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.87 2004/05/07 00:24:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.88 2004/05/14 16:11:25 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -120,6 +120,25 @@ defGetNumeric(DefElem *def)
}
/*
+ * Extract a boolean value from a DefElem.
+ */
+bool
+defGetBoolean(DefElem *def)
+{
+ /*
+ * Presently, boolean flags must simply be present or absent.
+ * Later we could allow 'flag = t', 'flag = f', etc.
+ */
+ if (def->arg == NULL)
+ return true;
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("%s does not take a parameter",
+ def->defname)));
+ return false; /* keep compiler quiet */
+}
+
+/*
* Extract an int64 value from a DefElem.
*/
int64
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index a0a9c582409..c118e8e3b5e 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.45 2004/05/07 00:24:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.46 2004/05/14 16:11:25 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -329,11 +329,12 @@ compute_attributes_with_style(List *parameters, bool *isStrict_p, char *volatili
DefElem *param = (DefElem *) lfirst(pl);
if (pg_strcasecmp(param->defname, "isstrict") == 0)
- *isStrict_p = true;
+ *isStrict_p = defGetBoolean(param);
else if (pg_strcasecmp(param->defname, "iscachable") == 0)
{
/* obsolete spelling of isImmutable */
- *volatility_p = PROVOLATILE_IMMUTABLE;
+ if (defGetBoolean(param))
+ *volatility_p = PROVOLATILE_IMMUTABLE;
}
else
ereport(WARNING,
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
index 2736a31f3c0..a198f51eeeb 100644
--- a/src/backend/commands/operatorcmds.c
+++ b/src/backend/commands/operatorcmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.14 2004/05/07 00:24:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.15 2004/05/14 16:11:25 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -124,9 +124,9 @@ DefineOperator(List *names, List *parameters)
else if (pg_strcasecmp(defel->defname, "join") == 0)
joinName = defGetQualifiedName(defel);
else if (pg_strcasecmp(defel->defname, "hashes") == 0)
- canHash = TRUE;
+ canHash = defGetBoolean(defel);
else if (pg_strcasecmp(defel->defname, "merges") == 0)
- canMerge = TRUE;
+ canMerge = defGetBoolean(defel);
else if (pg_strcasecmp(defel->defname, "sort1") == 0)
leftSortName = defGetQualifiedName(defel);
else if (pg_strcasecmp(defel->defname, "sort2") == 0)
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 411ad725bc8..03428369ff4 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.55 2004/05/07 00:24:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.56 2004/05/14 16:11:25 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -176,7 +176,7 @@ DefineType(List *names, List *parameters)
else if (pg_strcasecmp(defel->defname, "default") == 0)
defaultValue = defGetString(defel);
else if (pg_strcasecmp(defel->defname, "passedbyvalue") == 0)
- byValue = true;
+ byValue = defGetBoolean(defel);
else if (pg_strcasecmp(defel->defname, "alignment") == 0)
{
char *a = defGetString(defel);