10
10
* Written by Peter Eisentraut <peter_e@gmx.net>.
11
11
*
12
12
* IDENTIFICATION
13
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.310 2006/02/04 12:50:47 petere Exp $
13
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.311 2006/02/12 22:32:42 tgl Exp $
14
14
*
15
15
*--------------------------------------------------------------------
16
16
*/
48
48
#include "optimizer/planmain.h"
49
49
#include "parser/parse_expr.h"
50
50
#include "parser/parse_relation.h"
51
+ #include "parser/scansup.h"
51
52
#include "postmaster/autovacuum.h"
52
53
#include "postmaster/bgwriter.h"
53
54
#include "postmaster/syslogger.h"
@@ -1707,7 +1708,7 @@ static struct config_string ConfigureNamesString[] =
1707
1708
{"client_encoding" , PGC_USERSET , CLIENT_CONN_LOCALE ,
1708
1709
gettext_noop ("Sets the client's character set encoding." ),
1709
1710
NULL ,
1710
- GUC_REPORT
1711
+ GUC_IS_NAME | GUC_REPORT
1711
1712
},
1712
1713
& client_encoding_string ,
1713
1714
"SQL_ASCII" , assign_client_encoding , NULL
@@ -1787,7 +1788,8 @@ static struct config_string ConfigureNamesString[] =
1787
1788
{
1788
1789
{"default_tablespace" , PGC_USERSET , CLIENT_CONN_STATEMENT ,
1789
1790
gettext_noop ("Sets the default tablespace to create tables and indexes in." ),
1790
- gettext_noop ("An empty string selects the database's default tablespace." )
1791
+ gettext_noop ("An empty string selects the database's default tablespace." ),
1792
+ GUC_IS_NAME
1791
1793
},
1792
1794
& default_tablespace ,
1793
1795
"" , assign_default_tablespace , NULL
@@ -1945,7 +1947,7 @@ static struct config_string ConfigureNamesString[] =
1945
1947
{"server_encoding" , PGC_INTERNAL , CLIENT_CONN_LOCALE ,
1946
1948
gettext_noop ("Sets the server (database) character set encoding." ),
1947
1949
NULL ,
1948
- GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1950
+ GUC_IS_NAME | GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1949
1951
},
1950
1952
& server_encoding_string ,
1951
1953
"SQL_ASCII" , NULL , NULL
@@ -1967,7 +1969,7 @@ static struct config_string ConfigureNamesString[] =
1967
1969
{"role" , PGC_USERSET , UNGROUPED ,
1968
1970
gettext_noop ("Sets the current role." ),
1969
1971
NULL ,
1970
- GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1972
+ GUC_IS_NAME | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1971
1973
},
1972
1974
& role_string ,
1973
1975
"none" , assign_role , show_role
@@ -1978,7 +1980,7 @@ static struct config_string ConfigureNamesString[] =
1978
1980
{"session_authorization" , PGC_USERSET , UNGROUPED ,
1979
1981
gettext_noop ("Sets the session user name." ),
1980
1982
NULL ,
1981
- GUC_REPORT | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1983
+ GUC_IS_NAME | GUC_REPORT | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1982
1984
},
1983
1985
& session_authorization_string ,
1984
1986
NULL , assign_session_authorization , show_session_authorization
@@ -3988,6 +3990,12 @@ set_config_option(const char *name, const char *value,
3988
3990
newval = guc_strdup (elevel , value );
3989
3991
if (newval == NULL )
3990
3992
return false;
3993
+ /*
3994
+ * The only sort of "parsing" check we need to do is
3995
+ * apply truncation if GUC_IS_NAME.
3996
+ */
3997
+ if (conf -> gen .flags & GUC_IS_NAME )
3998
+ truncate_identifier (newval , strlen (newval ), true);
3991
3999
}
3992
4000
else if (conf -> reset_val )
3993
4001
{
0 commit comments