|
9 | 9 | *
|
10 | 10 | *
|
11 | 11 | * IDENTIFICATION
|
12 |
| - * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.64 2002/04/2214:34:27 thomas Exp $ |
| 12 | + * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.65 2002/04/2215:13:53 thomas Exp $ |
13 | 13 | *
|
14 | 14 | *-------------------------------------------------------------------------
|
15 | 15 | */
|
@@ -287,7 +287,8 @@ parse_datestyle(List *args)
|
287 | 287 | Value*s;
|
288 | 288 | Assert(IsA(type->names,List));
|
289 | 289 | s= (Value*)lfirst(type->names);
|
290 |
| -elog(ERROR,"SET DATESTYLE does not allow input of type %s",s->val.str); |
| 290 | +elog(ERROR,"SET DATESTYLE does not allow input of type %s" |
| 291 | +"\n\tUse an untyped string instead",s->val.str); |
291 | 292 | }
|
292 | 293 |
|
293 | 294 | value=v->val.str;
|
@@ -594,7 +595,7 @@ parse_XactIsoLevel(List *args)
|
594 | 595 | Assert(IsA(lfirst(args),A_Const));
|
595 | 596 | /* Should only get one argument from the parser */
|
596 | 597 | if (lnext(args)!=NIL)
|
597 |
| -elog(ERROR,"SET TRANSACTION ISOLATION LEVELdoes not allow multiple arguments"); |
| 598 | +elog(ERROR,"SET TRANSACTION ISOLATION LEVELtakes only one argument"); |
598 | 599 |
|
599 | 600 | Assert(((A_Const*)lfirst(args))->val.type=T_String);
|
600 | 601 | value= ((A_Const*)lfirst(args))->val.val.str;
|
@@ -657,7 +658,7 @@ parse_random_seed(List *args)
|
657 | 658 | Assert(IsA(args,List));
|
658 | 659 | /* Should only get one argument from the parser */
|
659 | 660 | if (lnext(args)!=NIL)
|
660 |
| -elog(ERROR,"SET SEEDdoes not allow multiple arguments"); |
| 661 | +elog(ERROR,"SET SEEDtakes only one argument"); |
661 | 662 |
|
662 | 663 | p=lfirst(args);
|
663 | 664 | Assert(IsA(p,A_Const));
|
@@ -720,7 +721,7 @@ parse_client_encoding(List *args)
|
720 | 721 | returnreset_client_encoding();
|
721 | 722 |
|
722 | 723 | if (lnext(args)!=NIL)
|
723 |
| -elog(ERROR,"SET CLIENT ENCODINGdoes not allow multiple arguments"); |
| 724 | +elog(ERROR,"SET CLIENT ENCODINGtakes only one argument"); |
724 | 725 |
|
725 | 726 | Assert(IsA(lfirst(args),A_Const));
|
726 | 727 | if (((A_Const*)lfirst(args))->val.type!=T_String)
|
@@ -852,15 +853,23 @@ SetPGVariable(const char *name, List *args)
|
852 | 853 | elog(ERROR,"SET %s takes only one argument",name);
|
853 | 854 |
|
854 | 855 | n= (A_Const*)lfirst(args);
|
855 |
| -/* If this is a T_Integer, then we should convert back to a string |
856 |
| - * but for now we just reject the parameter. |
857 |
| - */ |
858 |
| -if ((n->val.type!=T_String) |
859 |
| -&& (n->val.type!=T_Float)) |
860 |
| -elog(ERROR,"SET requires a string argument for this parameter" |
861 |
| -"\n\tInternal coding error: report to thomas@fourpalms.org"); |
862 |
| - |
863 |
| -value=n->val.val.str; |
| 856 | +if ((n->val.type==T_String) |
| 857 | +|| (n->val.type==T_Float)) |
| 858 | +{ |
| 859 | +value=n->val.val.str; |
| 860 | +} |
| 861 | +elseif (n->val.type==T_Integer) |
| 862 | +{ |
| 863 | +/* We should convert back to a string. */ |
| 864 | +value=DatumGetCString(DirectFunctionCall1(int4out,Int32GetDatum(n->val.val.ival))); |
| 865 | +} |
| 866 | +else |
| 867 | +{ |
| 868 | +elog(ERROR,"SET %s accepts a string argument for this parameter" |
| 869 | +"\n\tInternal coding error: report to thomas@fourpalms.org", |
| 870 | +name); |
| 871 | +value=NULL; |
| 872 | +} |
864 | 873 | }
|
865 | 874 | else
|
866 | 875 | {
|
|