diff options
| author | Tom Lane | 2004-01-19 19:04:40 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-01-19 19:04:40 +0000 |
| commit | 9bd681a5220186230e0ea0f718a71af7ebe4b560 (patch) | |
| tree | 3dddc229c62a5cc2b4da3ea50b2bc0b7256443d0 /src/include/utils | |
| parent | 239760209b739d06e19ed4935776aeb89b6605f1 (diff) | |
Repair problem identified by Olivier Prenant: ALTER DATABASE SET search_path
should not be too eager to reject paths involving unknown schemas, since
it can't really tell whether the schemas exist in the target database.
(Also, when reading pg_dumpall output, it could be that the schemas
don't exist yet, but eventually will.) ALTER USER SET has a similar issue.
So, reduce the normal ERROR to a NOTICE when checking search_path values
for these commands. Supporting this requires changing the API for GUC
assign_hook functions, which causes the patch to touch a lot of places,
but the changes are conceptually trivial.
Diffstat (limited to 'src/include/utils')
| -rw-r--r-- | src/include/utils/builtins.h | 6 | ||||
| -rw-r--r-- | src/include/utils/datetime.h | 3 | ||||
| -rw-r--r-- | src/include/utils/guc.h | 31 | ||||
| -rw-r--r-- | src/include/utils/guc_tables.h | 10 | ||||
| -rw-r--r-- | src/include/utils/pg_locale.h | 13 |
5 files changed, 45 insertions, 18 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index fa1e8b6c08b..dc5e2f267cc 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -7,7 +7,7 @@ * 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 $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,6 @@ #include "fmgr.h" #include "nodes/parsenodes.h" -#include "storage/itemptr.h" /* for setLastTid() */ /* * Defined in adt/ @@ -415,8 +414,6 @@ extern Datum texticregexeq(PG_FUNCTION_ARGS); 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); @@ -483,7 +480,6 @@ extern Datum tidsend(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); diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index cbb0d39e093..34a98454acc 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -9,7 +9,7 @@ * 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 $ * *------------------------------------------------------------------------- */ @@ -318,7 +318,6 @@ extern int EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str); 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); diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 29d731146d3..597f10069fd 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -7,7 +7,7 @@ * 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 @@ -76,6 +76,15 @@ typedef enum * * 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 { @@ -88,6 +97,8 @@ 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; @@ -152,4 +163,22 @@ void write_nondefault_variables(GucContext context); 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 */ diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h index c596e964eba..47e0339dafa 100644 --- a/src/include/utils/guc_tables.h +++ b/src/include/utils/guc_tables.h @@ -7,7 +7,7 @@ * * 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 $ * *------------------------------------------------------------------------- */ @@ -113,7 +113,7 @@ struct config_bool /* (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; @@ -129,7 +129,7 @@ struct config_int 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; @@ -145,7 +145,7 @@ struct config_real 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; @@ -159,7 +159,7 @@ struct config_string /* (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; diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h index ae2d1375219..970724ad24f 100644 --- a/src/include/utils/pg_locale.h +++ b/src/include/utils/pg_locale.h @@ -2,7 +2,7 @@ * * 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 * @@ -14,19 +14,22 @@ #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); |
