diff options
author | Thomas G. Lockhart <lockhart@fourpalms.org> | 2002-04-22 14:34:27 +0000 |
---|---|---|
committer | Thomas G. Lockhart <lockhart@fourpalms.org> | 2002-04-22 14:34:27 +0000 |
commit | 58ca6e091ee015571263ba84de79c2e5ee3f324d (patch) | |
tree | 88fe7e8d79bff4774051a762348737890508c1e6 /src/backend/commands/variable.c | |
parent | 8d2441e55c7d19ae0e9ff43f8bcff89b0c18e203 (diff) | |
download | postgresql-58ca6e091ee015571263ba84de79c2e5ee3f324d.tar.gz postgresql-58ca6e091ee015571263ba84de79c2e5ee3f324d.zip |
Check for multiple arguments on parameters which do not allow them.
The last version caught this with an assert because I wasn't sure whether
we should elog(ERROR) or just loop through the parameters.
Diffstat (limited to 'src/backend/commands/variable.c')
-rw-r--r-- | src/backend/commands/variable.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index 504f9c56b6f..0498c734ec1 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.63 2002/04/21 21:35:17 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.64 2002/04/22 14:34:27 thomas Exp $ * *------------------------------------------------------------------------- */ @@ -593,7 +593,8 @@ parse_XactIsoLevel(List *args) Assert(IsA(args, List)); Assert(IsA(lfirst(args), A_Const)); /* Should only get one argument from the parser */ - Assert(lnext(args) == NIL); + if (lnext(args) != NIL) + elog(ERROR, "SET TRANSACTION ISOLATION LEVEL does not allow multiple arguments"); Assert(((A_Const *) lfirst(args))->val.type = T_String); value = ((A_Const *) lfirst(args))->val.val.str; @@ -655,7 +656,8 @@ parse_random_seed(List *args) Assert(IsA(args, List)); /* Should only get one argument from the parser */ - Assert(lnext(args) == NIL); + if (lnext(args) != NIL) + elog(ERROR, "SET SEED does not allow multiple arguments"); p = lfirst(args); Assert(IsA(p, A_Const)); @@ -717,6 +719,9 @@ parse_client_encoding(List *args) if (args == NULL) return reset_client_encoding(); + if (lnext(args) != NIL) + elog(ERROR, "SET CLIENT ENCODING does not allow multiple arguments"); + Assert(IsA(lfirst(args), A_Const)); if (((A_Const *) lfirst(args))->val.type != T_String) { @@ -844,7 +849,8 @@ SetPGVariable(const char *name, List *args) /* Ensure one argument only... */ if (lnext(args) != NIL) - elog(ERROR, "SET takes only one argument for this parameter"); + elog(ERROR, "SET %s takes only one argument", name); + n = (A_Const *) lfirst(args); /* If this is a T_Integer, then we should convert back to a string * but for now we just reject the parameter. |