* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.131 2004/01/06 22:22:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.132 2004/01/19 19:04:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* GUC support
*/
const char *
-assign_xlog_sync_method(const char *method, bool doit, bool interactive)
+assign_xlog_sync_method(const char *method, bool doit, GucSource source)
{
int new_sync_method;
int new_sync_bit;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.61 2003/12/29 21:33:09 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.62 2004/01/19 19:04:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/catcache.h"
+#include "utils/guc.h"
#include "utils/inval.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
/* assign_hook: validate new search_path, do extra actions as needed */
const char *
-assign_search_path(const char *newval, bool doit, bool interactive)
+assign_search_path(const char *newval, bool doit, GucSource source)
{
char *rawname;
List *namelist;
* If we aren't inside a transaction, we cannot do database access so
* cannot verify the individual names. Must accept the list on faith.
*/
- if (interactive && IsTransactionState())
+ if (source >= PGC_S_INTERACTIVE && IsTransactionState())
{
/*
* Verify that all the names are either valid namespace names or
* "$user". We do not require $user to correspond to a valid
* namespace. We do not check for USAGE rights, either; should
* we?
+ *
+ * When source == PGC_S_TEST, we are checking the argument of an
+ * ALTER DATABASE SET or ALTER USER SET command. It could be that
+ * the intended use of the search path is for some other database,
+ * so we should not error out if it mentions schemas not present
+ * in the current database. We reduce the message to NOTICE instead.
*/
foreach(l, namelist)
{
if (!SearchSysCacheExists(NAMESPACENAME,
CStringGetDatum(curname),
0, 0, 0))
- ereport(ERROR,
+ ereport((source == PGC_S_TEST) ? NOTICE : ERROR,
(errcode(ERRCODE_UNDEFINED_SCHEMA),
errmsg("schema \"%s\" does not exist", curname)));
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.92 2003/12/21 04:34:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.93 2004/01/19 19:04:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* assign_datestyle: GUC assign_hook for datestyle
*/
const char *
-assign_datestyle(const char *value, bool doit, bool interactive)
+assign_datestyle(const char *value, bool doit, GucSource source)
{
int newDateStyle = DateStyle;
int newDateOrder = DateOrder;
/* syntax error in list */
pfree(rawstring);
freeList(elemlist);
- if (interactive)
+ if (source >= PGC_S_INTERACTIVE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid list syntax for parameter \"datestyle\"")));
const char *subval;
subval = assign_datestyle(GetConfigOptionResetString("datestyle"),
- true, interactive);
+ true, source);
if (scnt == 0)
newDateStyle = DateStyle;
if (ocnt == 0)
}
else
{
- if (interactive)
+ if (source >= PGC_S_INTERACTIVE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized \"datestyle\" key word: \"%s\"",
if (!ok)
{
- if (interactive)
+ if (source >= PGC_S_INTERACTIVE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("conflicting \"datestyle\" specifications")));
* assign_timezone: GUC assign_hook for timezone
*/
const char *
-assign_timezone(const char *value, bool doit, bool interactive)
+assign_timezone(const char *value, bool doit, GucSource source)
{
char *result;
char *endptr;
pfree(val);
if (interval->month != 0)
{
- if (interactive)
+ if (source >= PGC_S_INTERACTIVE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid interval value for time zone: month not allowed")));
/* Complain if it was bad */
if (!known)
{
- ereport(interactive ? ERROR : LOG,
+ ereport((source >= PGC_S_INTERACTIVE) ? ERROR : LOG,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized time zone name: \"%s\"",
value)));
}
if (!acceptable)
{
- ereport(interactive ? ERROR : LOG,
+ ereport((source >= PGC_S_INTERACTIVE) ? ERROR : LOG,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("time zone \"%s\" appears to use leap seconds",
value),
*/
const char *
-assign_XactIsoLevel(const char *value, bool doit, bool interactive)
+assign_XactIsoLevel(const char *value, bool doit, GucSource source)
{
- if (doit && interactive && SerializableSnapshot != NULL)
+ if (doit && source >= PGC_S_INTERACTIVE && SerializableSnapshot != NULL)
ereport(ERROR,
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
errmsg("SET TRANSACTION ISOLATION LEVEL must be called before any query")));
*/
bool
-assign_random_seed(double value, bool doit, bool interactive)
+assign_random_seed(double value, bool doit, GucSource source)
{
/* Can't really roll back on error, so ignore non-interactive setting */
- if (doit && interactive)
+ if (doit && source >= PGC_S_INTERACTIVE)
DirectFunctionCall1(setseed, Float8GetDatum(value));
return true;
}
*/
const char *
-assign_client_encoding(const char *value, bool doit, bool interactive)
+assign_client_encoding(const char *value, bool doit, GucSource source)
{
int encoding;
*/
if (SetClientEncoding(encoding, doit) < 0)
{
- if (interactive)
+ if (source >= PGC_S_INTERACTIVE)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("conversion between %s and %s is not supported",
* because of the NAMEDATALEN limit on names.
*/
const char *
-assign_session_authorization(const char *value, bool doit, bool interactive)
+assign_session_authorization(const char *value, bool doit, GucSource source)
{
AclId usesysid = 0;
bool is_superuser = false;
0, 0, 0);
if (!HeapTupleIsValid(userTup))
{
- if (interactive)
+ if (source >= PGC_S_INTERACTIVE)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("user \"%s\" does not exist", value)));
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.123 2003/12/21 04:34:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.124 2004/01/19 19:04:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* GUC assign_hook for australian_timezones */
bool
-ClearDateCache(bool newval, bool doit, bool interactive)
+ClearDateCache(bool newval, bool doit, GucSource source)
{
int i;
*
* Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.24 2003/11/29 19:51:59 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.25 2004/01/19 19:04:40 tgl Exp $
*
*-----------------------------------------------------------------------
*/
* valid. (See explanation at the top of this file.)
*/
static const char *
-locale_xxx_assign(int category, const char *value, bool doit, bool interactive)
+locale_xxx_assign(int category, const char *value, bool doit, GucSource source)
{
char *save;
const char *
-locale_monetary_assign(const char *value, bool doit, bool interactive)
+locale_monetary_assign(const char *value, bool doit, GucSource source)
{
- return locale_xxx_assign(LC_MONETARY, value, doit, interactive);
+ return locale_xxx_assign(LC_MONETARY, value, doit, source);
}
const char *
-locale_numeric_assign(const char *value, bool doit, bool interactive)
+locale_numeric_assign(const char *value, bool doit, GucSource source)
{
- return locale_xxx_assign(LC_NUMERIC, value, doit, interactive);
+ return locale_xxx_assign(LC_NUMERIC, value, doit, source);
}
const char *
-locale_time_assign(const char *value, bool doit, bool interactive)
+locale_time_assign(const char *value, bool doit, GucSource source)
{
- return locale_xxx_assign(LC_TIME, value, doit, interactive);
+ return locale_xxx_assign(LC_TIME, value, doit, source);
}
* We allow LC_MESSAGES to actually be set globally.
*/
const char *
-locale_messages_assign(const char *value, bool doit, bool interactive)
+locale_messages_assign(const char *value, bool doit, GucSource source)
{
/*
* LC_MESSAGES category does not exist everywhere, but accept it
return NULL;
}
else
- value = locale_xxx_assign(LC_MESSAGES, value, false, interactive);
+ value = locale_xxx_assign(LC_MESSAGES, value, false, source);
#endif
return value;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.50 2003/11/29 19:51:59 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.51 2004/01/19 19:04:40 tgl Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
#include "regex/regex.h"
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
+#include "utils/guc.h"
/* GUC-settable flavor parameter */
*/
const char *
assign_regex_flavor(const char *value,
- bool doit, bool interactive)
+ bool doit, GucSource source)
{
if (strcasecmp(value, "advanced") == 0)
{
-$PostgreSQL: pgsql/src/backend/utils/misc/README,v 1.3 2003/11/29 19:52:03 pgsql Exp $
+$PostgreSQL: pgsql/src/backend/utils/misc/README,v 1.4 2004/01/19 19:04:40 tgl Exp $
GUC IMPLEMENTATION NOTES
the default SHOW display for a variable.
If an assign_hook is provided, it points to a function of the signature
- bool assign_hook(newvalue, bool doit, bool interactive)
-where the type of 'newvalue' matches the kind of variable. This function
+ bool assign_hook(newvalue, bool doit, GucSource source)
+where the type of "newvalue" matches the kind of variable. This function
is called immediately before actually setting the variable's value (so it
can look at the actual variable to determine the old value). If the
function returns "true" then the assignment is completed; if it returns
"false" then newvalue is considered invalid and the assignment is not
performed. If "doit" is false then the function should simply check
-validity of newvalue and not change any derived state. "interactive" is
-true when we are performing a SET command; in this case it is okay for the
-assign_hook to raise an error via elog(). If the function returns false
-for an interactive assignment then guc.c will report a generic "invalid
-value" error message. (An internal elog() in an assign_hook is only
-needed if you want to generate a specialized error message.) But when
-"interactive" is false we are reading a non-interactive option source,
-such as postgresql.conf. In this case the assign_hook should *not* elog
-but should just return false if it doesn't like the newvalue. (An
-elog(LOG) call would be acceptable if you feel a need for a custom
-complaint in this situation.)
+validity of newvalue and not change any derived state. The "source" parameter
+indicates where the new value came from. If it is >= PGC_S_INTERACTIVE,
+then we are performing an interactive assignment (e.g., a SET command).
+In such cases it is okay for the assign_hook to raise an error via ereport().
+If the function returns false for an interactive assignment then guc.c will
+report a generic "invalid value" error message. (An internal ereport() in
+an assign_hook is only needed if you want to generate a specialized error
+message.) But when source < PGC_S_INTERACTIVE, we are reading a
+non-interactive option source, such as postgresql.conf. In this case the
+assign_hook should *not* ereport but should just return false if it doesn't
+like the newvalue. (An ereport(LOG) call would be acceptable if you feel a
+need for a custom complaint in this situation.)
For string variables, the signature for assign hooks is a bit different:
const char *assign_hook(const char *newvalue,
bool doit,
- bool interactive)
+ GucSource source)
The meanings of the parameters are the same as for the other types of GUC
variables, but the return value is handled differently:
NULL --- assignment fails (like returning false for other datatypes)
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.176 2004/01/06 17:26:23 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.177 2004/01/19 19:04:40 tgl Exp $
*
*--------------------------------------------------------------------
*/
#include "utils/guc.h"
#include "utils/guc_tables.h"
-#include "access/xlog.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "commands/async.h"
#include "tcop/tcopprot.h"
#include "utils/array.h"
#include "utils/builtins.h"
-#include "utils/datetime.h"
#include "utils/pg_locale.h"
#include "pgstat.h"
extern char *Syslog_ident;
static const char *assign_facility(const char *facility,
- bool doit, bool interactive);
+ bool doit, GucSource source);
#endif
static const char *assign_defaultxactisolevel(const char *newval,
- bool doit, bool interactive);
+ bool doit, GucSource source);
static const char *assign_log_min_messages(const char *newval,
- bool doit, bool interactive);
+ bool doit, GucSource source);
static const char *assign_client_min_messages(const char *newval,
- bool doit, bool interactive);
+ bool doit, GucSource source);
static const char *assign_min_error_statement(const char *newval, bool doit,
- bool interactive);
+ GucSource source);
static const char *assign_msglvl(int *var, const char *newval,
- bool doit, bool interactive);
+ bool doit, GucSource source);
static const char *assign_log_error_verbosity(const char *newval, bool doit,
- bool interactive);
-static bool assign_phony_autocommit(bool newval, bool doit, bool interactive);
+ GucSource source);
+static bool assign_phony_autocommit(bool newval, bool doit, GucSource source);
/*
*/
const char *const GucSource_Names[] =
{
- /* PGC_S_DEFAULT */ "default",
- /* PGC_S_ENV_VAR */ "environment variable",
- /* PGC_S_FILE */ "configuration file",
- /* PGC_S_ARGV */ "command line",
- /* PGC_S_UNPRIVILEGED */ "unprivileged",
- /* PGC_S_DATABASE */ "database",
- /* PGC_S_USER */ "user",
- /* PGC_S_CLIENT */ "client",
- /* PGC_S_OVERRIDE */ "override",
- /* PGC_S_SESSION */ "session"
+ /* PGC_S_DEFAULT */ "default",
+ /* PGC_S_ENV_VAR */ "environment variable",
+ /* PGC_S_FILE */ "configuration file",
+ /* PGC_S_ARGV */ "command line",
+ /* PGC_S_UNPRIVILEGED */ "unprivileged",
+ /* PGC_S_DATABASE */ "database",
+ /* PGC_S_USER */ "user",
+ /* PGC_S_CLIENT */ "client",
+ /* PGC_S_OVERRIDE */ "override",
+ /* PGC_S_INTERACTIVE */ "interactive",
+ /* PGC_S_TEST */ "test",
+ /* PGC_S_SESSION */ "session"
};
/*
struct config_bool *conf = (struct config_bool *) gconf;
if (conf->assign_hook)
- if (!(*conf->assign_hook) (conf->reset_val, true, false))
+ if (!(*conf->assign_hook) (conf->reset_val, true,
+ PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %d",
conf->gen.name, (int) conf->reset_val);
*conf->variable = conf->reset_val;
Assert(conf->gen.context != PGC_USERLIMIT ||
strcmp(conf->gen.name, "log_min_duration_statement") == 0);
if (conf->assign_hook)
- if (!(*conf->assign_hook) (conf->reset_val, true, false))
+ if (!(*conf->assign_hook) (conf->reset_val, true,
+ PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %d",
conf->gen.name, conf->reset_val);
*conf->variable = conf->reset_val;
Assert(conf->reset_val <= conf->max);
Assert(conf->gen.context != PGC_USERLIMIT);
if (conf->assign_hook)
- if (!(*conf->assign_hook) (conf->reset_val, true, false))
+ if (!(*conf->assign_hook) (conf->reset_val, true,
+ PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %g",
conf->gen.name, conf->reset_val);
*conf->variable = conf->reset_val;
{
const char *newstr;
- newstr = (*conf->assign_hook) (str, true, false);
+ newstr = (*conf->assign_hook) (str, true,
+ PGC_S_DEFAULT);
if (newstr == NULL)
{
elog(FATAL, "failed to initialize %s to \"%s\"",
struct config_bool *conf = (struct config_bool *) gconf;
if (conf->assign_hook)
- if (!(*conf->assign_hook) (conf->reset_val, true, true))
+ if (!(*conf->assign_hook) (conf->reset_val, true,
+ PGC_S_SESSION))
elog(ERROR, "failed to reset %s", conf->gen.name);
*conf->variable = conf->reset_val;
conf->tentative_val = conf->reset_val;
struct config_int *conf = (struct config_int *) gconf;
if (conf->assign_hook)
- if (!(*conf->assign_hook) (conf->reset_val, true, true))
+ if (!(*conf->assign_hook) (conf->reset_val, true,
+ PGC_S_SESSION))
elog(ERROR, "failed to reset %s", conf->gen.name);
*conf->variable = conf->reset_val;
conf->tentative_val = conf->reset_val;
struct config_real *conf = (struct config_real *) gconf;
if (conf->assign_hook)
- if (!(*conf->assign_hook) (conf->reset_val, true, true))
+ if (!(*conf->assign_hook) (conf->reset_val, true,
+ PGC_S_SESSION))
elog(ERROR, "failed to reset %s", conf->gen.name);
*conf->variable = conf->reset_val;
conf->tentative_val = conf->reset_val;
{
const char *newstr;
- newstr = (*conf->assign_hook) (str, true, true);
+ newstr = (*conf->assign_hook) (str, true,
+ PGC_S_SESSION);
if (newstr == NULL)
elog(ERROR, "failed to reset %s", conf->gen.name);
else if (newstr != str)
{
if (conf->assign_hook)
if (!(*conf->assign_hook) (conf->session_val,
- true, false))
+ true, PGC_S_OVERRIDE))
elog(LOG, "failed to commit %s",
conf->gen.name);
*conf->variable = conf->session_val;
{
if (conf->assign_hook)
if (!(*conf->assign_hook) (conf->session_val,
- true, false))
+ true, PGC_S_OVERRIDE))
elog(LOG, "failed to commit %s",
conf->gen.name);
*conf->variable = conf->session_val;
{
if (conf->assign_hook)
if (!(*conf->assign_hook) (conf->session_val,
- true, false))
+ true, PGC_S_OVERRIDE))
elog(LOG, "failed to commit %s",
conf->gen.name);
*conf->variable = conf->session_val;
{
const char *newstr;
- newstr = (*conf->assign_hook) (str, true, false);
+ newstr = (*conf->assign_hook) (str, true,
+ PGC_S_OVERRIDE);
if (newstr == NULL)
elog(LOG, "failed to commit %s",
conf->gen.name);
{
struct config_generic *record;
int elevel;
- bool interactive;
bool makeDefault;
bool changeVal_orig;
break;
}
- /* Should we report errors interactively? */
- interactive = (source >= PGC_S_SESSION);
-
/*
* Should we set reset/session values? (If so, the behavior is not
* transactional.)
}
if (conf->assign_hook)
- if (!(*conf->assign_hook) (newval, changeVal, interactive))
+ if (!(*conf->assign_hook) (newval, changeVal, source))
{
ereport(elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
}
if (conf->assign_hook)
- if (!(*conf->assign_hook) (newval, changeVal, interactive))
+ if (!(*conf->assign_hook) (newval, changeVal, source))
{
ereport(elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
}
if (conf->assign_hook)
- if (!(*conf->assign_hook) (newval, changeVal, interactive))
+ if (!(*conf->assign_hook) (newval, changeVal, source))
{
ereport(elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
/* all USERLIMIT strings are message levels */
assign_msglvl(&old_int_value, conf->reset_val,
- true, interactive);
+ true, source);
assign_msglvl(&new_int_value, newval,
- true, interactive);
+ true, source);
/* Limit non-superuser changes */
if (source > PGC_S_UNPRIVILEGED &&
new_int_value > old_int_value &&
const char *hookresult;
hookresult = (*conf->assign_hook) (newval,
- changeVal, interactive);
+ changeVal, source);
guc_string_workspace = NULL;
if (hookresult == NULL)
{
/* test if the option is valid */
set_config_option(name, value,
superuser() ? PGC_SUSET : PGC_USERSET,
- PGC_S_SESSION, false, false);
+ PGC_S_TEST, false, false);
/* convert name to canonical spelling, so we can use plain strcmp */
(void) GetConfigOptionByName(name, &varname);
/* test if the option is valid */
set_config_option(name, NULL,
superuser() ? PGC_SUSET : PGC_USERSET,
- PGC_S_SESSION, false, false);
+ PGC_S_TEST, false, false);
/* convert name to canonical spelling, so we can use plain strcmp */
(void) GetConfigOptionByName(name, &varname);
#ifdef HAVE_SYSLOG
static const char *
-assign_facility(const char *facility, bool doit, bool interactive)
+assign_facility(const char *facility, bool doit, GucSource source)
{
if (strcasecmp(facility, "LOCAL0") == 0)
return facility;
static const char *
-assign_defaultxactisolevel(const char *newval, bool doit, bool interactive)
+assign_defaultxactisolevel(const char *newval, bool doit, GucSource source)
{
if (strcasecmp(newval, "serializable") == 0)
{
static const char *
assign_log_min_messages(const char *newval,
- bool doit, bool interactive)
+ bool doit, GucSource source)
{
- return (assign_msglvl(&log_min_messages, newval, doit, interactive));
+ return (assign_msglvl(&log_min_messages, newval, doit, source));
}
static const char *
assign_client_min_messages(const char *newval,
- bool doit, bool interactive)
+ bool doit, GucSource source)
{
- return (assign_msglvl(&client_min_messages, newval, doit, interactive));
+ return (assign_msglvl(&client_min_messages, newval, doit, source));
}
static const char *
-assign_min_error_statement(const char *newval, bool doit, bool interactive)
+assign_min_error_statement(const char *newval, bool doit, GucSource source)
{
- return (assign_msglvl(&log_min_error_statement, newval, doit, interactive));
+ return (assign_msglvl(&log_min_error_statement, newval, doit, source));
}
static const char *
-assign_msglvl(int *var, const char *newval, bool doit, bool interactive)
+assign_msglvl(int *var, const char *newval, bool doit, GucSource source)
{
if (strcasecmp(newval, "debug") == 0)
{
}
static const char *
-assign_log_error_verbosity(const char *newval, bool doit, bool interactive)
+assign_log_error_verbosity(const char *newval, bool doit, GucSource source)
{
if (strcasecmp(newval, "terse") == 0)
{
}
static bool
-assign_phony_autocommit(bool newval, bool doit, bool interactive)
+assign_phony_autocommit(bool newval, bool doit, GucSource source)
{
if (!newval)
{
- if (doit && interactive)
+ if (doit && source >= PGC_S_INTERACTIVE)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SET AUTOCOMMIT TO OFF is no longer supported")));
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.47 2004/01/06 17:26:23 neilc Exp $
+ * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.48 2004/01/19 19:04:40 tgl Exp $
*/
#ifndef XLOG_H
#define XLOG_H
*/
extern XLogRecPtr GetUndoRecPtr(void);
-extern const char *assign_xlog_sync_method(const char *method,
- bool doit, bool interactive);
-
#endif /* XLOG_H */
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.29 2003/11/29 22:40:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/namespace.h,v 1.30 2004/01/19 19:04:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* stuff for search_path GUC variable */
extern char *namespace_search_path;
-extern const char *assign_search_path(const char *newval,
- bool doit, bool interactive);
-
extern List *fetch_search_path(bool includeImplicit);
#endif /* NAMESPACE_H */
* variable.h
* Routines for handling specialized SET variables.
*
- * $PostgreSQL: pgsql/src/include/commands/variable.h,v 1.22 2003/11/29 22:40:59 pgsql Exp $
+ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
*
+ * $PostgreSQL: pgsql/src/include/commands/variable.h,v 1.23 2004/01/19 19:04:40 tgl Exp $
*/
#ifndef VARIABLE_H
#define VARIABLE_H
+#include "utils/guc.h"
+
+
extern const char *assign_datestyle(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *assign_timezone(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *show_timezone(void);
extern const char *assign_XactIsoLevel(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *show_XactIsoLevel(void);
extern bool assign_random_seed(double value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *show_random_seed(void);
extern const char *assign_client_encoding(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *assign_session_authorization(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *show_session_authorization(void);
#endif /* VARIABLE_H */
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.232 2003/12/01 23:12:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.233 2004/01/19 19:04:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "fmgr.h"
#include "nodes/parsenodes.h"
-#include "storage/itemptr.h" /* for setLastTid() */
/*
* Defined in adt/
extern Datum texticregexne(PG_FUNCTION_ARGS);
extern Datum textregexsubstr(PG_FUNCTION_ARGS);
extern Datum similar_escape(PG_FUNCTION_ARGS);
-extern const char *assign_regex_flavor(const char *value,
- bool doit, bool interactive);
/* regproc.c */
extern Datum regprocin(PG_FUNCTION_ARGS);
extern Datum tideq(PG_FUNCTION_ARGS);
extern Datum currtid_byreloid(PG_FUNCTION_ARGS);
extern Datum currtid_byrelname(PG_FUNCTION_ARGS);
-extern void setLastTid(const ItemPointer tid);
/* varchar.c */
extern Datum bpcharin(PG_FUNCTION_ARGS);
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.46 2003/11/29 22:41:15 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.47 2004/01/19 19:04:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
extern int DecodeSpecial(int field, char *lowtoken, int *val);
extern int DecodeUnits(int field, char *lowtoken, int *val);
-extern bool ClearDateCache(bool newval, bool doit, bool interactive);
extern int j2day(int jd);
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
- * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.43 2003/12/01 22:08:02 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.44 2004/01/19 19:04:40 tgl Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
*
* PGC_S_UNPRIVILEGED isn't actually a source value, but the dividing line
* between privileged and unprivileged sources for USERLIMIT purposes.
+ * Similarly, PGC_S_INTERACTIVE isn't a real source value, but is the
+ * dividing line between "interactive" and "non-interactive" sources for
+ * error reporting purposes.
+ *
+ * PGC_S_TEST is used when testing values to be stored as per-database or
+ * per-user defaults ("doit" will always be false, so this never gets stored
+ * as the actual source of any value). This is an interactive case, but
+ * it needs its own source value because some assign hooks need to make
+ * different validity checks in this case.
*/
typedef enum
{
PGC_S_USER, /* per-user setting */
PGC_S_CLIENT, /* from client connection request */
PGC_S_OVERRIDE, /* special case to forcibly set default */
+ PGC_S_INTERACTIVE, /* dividing line for error reporting */
+ PGC_S_TEST, /* test per-database or per-user setting */
PGC_S_SESSION /* SET command */
} GucSource;
void read_nondefault_variables(void);
#endif
+/*
+ * The following functions are not in guc.c, but are declared here to avoid
+ * having to include guc.h in some widely used headers that it really doesn't
+ * belong in.
+ */
+
+/* in utils/adt/datetime.c */
+extern bool ClearDateCache(bool newval, bool doit, GucSource source);
+/* in utils/adt/regexp.c */
+extern const char *assign_regex_flavor(const char *value,
+ bool doit, GucSource source);
+/* in catalog/namespace.c */
+extern const char *assign_search_path(const char *newval,
+ bool doit, GucSource source);
+/* in access/transam/xlog.c */
+extern const char *assign_xlog_sync_method(const char *method,
+ bool doit, GucSource source);
+
#endif /* GUC_H */
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.8 2003/12/03 18:52:00 joe Exp $
+ * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.9 2004/01/19 19:04:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* (all but reset_val are constants) */
bool *variable;
bool reset_val;
- bool (*assign_hook) (bool newval, bool doit, bool interactive);
+ bool (*assign_hook) (bool newval, bool doit, GucSource source);
const char *(*show_hook) (void);
/* variable fields, initialized at runtime: */
bool session_val;
int reset_val;
int min;
int max;
- bool (*assign_hook) (int newval, bool doit, bool interactive);
+ bool (*assign_hook) (int newval, bool doit, GucSource source);
const char *(*show_hook) (void);
/* variable fields, initialized at runtime: */
int session_val;
double reset_val;
double min;
double max;
- bool (*assign_hook) (double newval, bool doit, bool interactive);
+ bool (*assign_hook) (double newval, bool doit, GucSource source);
const char *(*show_hook) (void);
/* variable fields, initialized at runtime: */
double session_val;
/* (all are constants) */
char **variable;
const char *boot_val;
- const char *(*assign_hook) (const char *newval, bool doit, bool interactive);
+ const char *(*assign_hook) (const char *newval, bool doit, GucSource source);
const char *(*show_hook) (void);
/* variable fields, initialized at runtime: */
char *reset_val;
*
* PostgreSQL locale utilities
*
- * $PostgreSQL: pgsql/src/include/utils/pg_locale.h,v 1.16 2003/11/29 22:41:16 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/utils/pg_locale.h,v 1.17 2004/01/19 19:04:40 tgl Exp $
*
* Copyright (c) 2002-2003, PostgreSQL Global Development Group
*
#include <locale.h>
+#include "utils/guc.h"
+
+
extern char *locale_messages;
extern char *locale_monetary;
extern char *locale_numeric;
extern char *locale_time;
extern const char *locale_messages_assign(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *locale_monetary_assign(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *locale_numeric_assign(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern const char *locale_time_assign(const char *value,
- bool doit, bool interactive);
+ bool doit, GucSource source);
extern bool lc_collate_is_c(void);
int tm2timestamp(struct tm *, fsec_t, int *, timestamp *);
int DecodeUnits(int field, char *lowtoken, int *val);
-bool ClearDateCache(bool, bool, bool);
bool CheckDateTokenTables(void);