mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Tighten parsing of boolean options to CREATE TYPE and related functions,
so as to deliver more useful error messages for mistakes like 'PASSEDBYVALUE = f'. Per gripe from Gaetano Mendola.
This commit is contained in:
@ -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
|
||||
@ -119,6 +119,25 @@ defGetNumeric(DefElem *def)
|
||||
return 0; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user