Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit58ca6e0

Browse files
author
Thomas G. Lockhart
committed
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.
1 parent8d2441e commit58ca6e0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎src/backend/commands/variable.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.63 2002/04/21 21:35:17 thomas Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.64 2002/04/22 14:34:27 thomas Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -593,7 +593,8 @@ parse_XactIsoLevel(List *args)
593593
Assert(IsA(args,List));
594594
Assert(IsA(lfirst(args),A_Const));
595595
/* Should only get one argument from the parser */
596-
Assert(lnext(args)==NIL);
596+
if (lnext(args)!=NIL)
597+
elog(ERROR,"SET TRANSACTION ISOLATION LEVEL does not allow multiple arguments");
597598

598599
Assert(((A_Const*)lfirst(args))->val.type=T_String);
599600
value= ((A_Const*)lfirst(args))->val.val.str;
@@ -655,7 +656,8 @@ parse_random_seed(List *args)
655656

656657
Assert(IsA(args,List));
657658
/* Should only get one argument from the parser */
658-
Assert(lnext(args)==NIL);
659+
if (lnext(args)!=NIL)
660+
elog(ERROR,"SET SEED does not allow multiple arguments");
659661

660662
p=lfirst(args);
661663
Assert(IsA(p,A_Const));
@@ -717,6 +719,9 @@ parse_client_encoding(List *args)
717719
if (args==NULL)
718720
returnreset_client_encoding();
719721

722+
if (lnext(args)!=NIL)
723+
elog(ERROR,"SET CLIENT ENCODING does not allow multiple arguments");
724+
720725
Assert(IsA(lfirst(args),A_Const));
721726
if (((A_Const*)lfirst(args))->val.type!=T_String)
722727
{
@@ -844,7 +849,8 @@ SetPGVariable(const char *name, List *args)
844849

845850
/* Ensure one argument only... */
846851
if (lnext(args)!=NIL)
847-
elog(ERROR,"SET takes only one argument for this parameter");
852+
elog(ERROR,"SET %s takes only one argument",name);
853+
848854
n= (A_Const*)lfirst(args);
849855
/* If this is a T_Integer, then we should convert back to a string
850856
* but for now we just reject the parameter.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp