Thread: Patch for search_path --- apply to 7.4 branch?

Patch for search_path --- apply to 7.4 branch?

From
Tom Lane
Date:
Attached is the patch I just applied to CVS HEAD to fix the search_path
problem that Olivier Prenant recently identified (can't set a search
path for another database if it mentions schemas not present in the
current database).  I am looking for comments on whether to back-patch
this into REL7_4_STABLE.  It is a rather large patch to fix what might
be considered a non-critical problem, so I'm a bit hesitant about back
patching.  Any opinions?

            regards, tom lane

*** src/backend/access/transam/xlog.c.orig    Tue Jan  6 17:22:37 2004
--- src/backend/access/transam/xlog.c    Mon Jan 19 13:21:29 2004
***************
*** 3523,3529 ****
   * GUC support
   */
  const char *
! assign_xlog_sync_method(const char *method, bool doit, bool interactive)
  {
      int            new_sync_method;
      int            new_sync_bit;
--- 3523,3529 ----
   * GUC support
   */
  const char *
! assign_xlog_sync_method(const char *method, bool doit, GucSource source)
  {
      int            new_sync_method;
      int            new_sync_bit;
*** src/backend/catalog/namespace.c.orig    Tue Dec 30 17:03:39 2003
--- src/backend/catalog/namespace.c    Mon Jan 19 13:36:24 2004
***************
*** 39,44 ****
--- 39,45 ----
  #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"
***************
*** 1773,1779 ****

  /* assign_hook: validate new search_path, do extra actions as needed */
  const char *
! assign_search_path(const char *newval, bool doit, bool interactive)
  {
      char       *rawname;
      List       *namelist;
--- 1774,1780 ----

  /* assign_hook: validate new search_path, do extra actions as needed */
  const char *
! assign_search_path(const char *newval, bool doit, GucSource source)
  {
      char       *rawname;
      List       *namelist;
***************
*** 1795,1807 ****
       * 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())
      {
          /*
           * 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?
           */
          foreach(l, namelist)
          {
--- 1796,1814 ----
       * 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 (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)
          {
***************
*** 1812,1818 ****
              if (!SearchSysCacheExists(NAMESPACENAME,
                                        CStringGetDatum(curname),
                                        0, 0, 0))
!                 ereport(ERROR,
                          (errcode(ERRCODE_UNDEFINED_SCHEMA),
                         errmsg("schema \"%s\" does not exist", curname)));
          }
--- 1819,1825 ----
              if (!SearchSysCacheExists(NAMESPACENAME,
                                        CStringGetDatum(curname),
                                        0, 0, 0))
!                 ereport((source == PGC_S_TEST) ? NOTICE : ERROR,
                          (errcode(ERRCODE_UNDEFINED_SCHEMA),
                         errmsg("schema \"%s\" does not exist", curname)));
          }
*** src/backend/commands/variable.c.orig    Sun Dec 21 17:53:44 2003
--- src/backend/commands/variable.c    Mon Jan 19 13:30:06 2004
***************
*** 48,54 ****
   * assign_datestyle: GUC assign_hook for datestyle
   */
  const char *
! assign_datestyle(const char *value, bool doit, bool interactive)
  {
      int            newDateStyle = DateStyle;
      int            newDateOrder = DateOrder;
--- 48,54 ----
   * assign_datestyle: GUC assign_hook for datestyle
   */
  const char *
! assign_datestyle(const char *value, bool doit, GucSource source)
  {
      int            newDateStyle = DateStyle;
      int            newDateOrder = DateOrder;
***************
*** 69,75 ****
          /* syntax error in list */
          pfree(rawstring);
          freeList(elemlist);
!         if (interactive)
              ereport(ERROR,
                      (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                       errmsg("invalid list syntax for parameter \"datestyle\"")));
--- 69,75 ----
          /* syntax error in list */
          pfree(rawstring);
          freeList(elemlist);
!         if (source >= PGC_S_INTERACTIVE)
              ereport(ERROR,
                      (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                       errmsg("invalid list syntax for parameter \"datestyle\"")));
***************
*** 137,143 ****
              const char *subval;

              subval = assign_datestyle(GetConfigOptionResetString("datestyle"),
!                                       true, interactive);
              if (scnt == 0)
                  newDateStyle = DateStyle;
              if (ocnt == 0)
--- 137,143 ----
              const char *subval;

              subval = assign_datestyle(GetConfigOptionResetString("datestyle"),
!                                       true, source);
              if (scnt == 0)
                  newDateStyle = DateStyle;
              if (ocnt == 0)
***************
*** 155,161 ****
          }
          else
          {
!             if (interactive)
                  ereport(ERROR,
                          (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                           errmsg("unrecognized \"datestyle\" key word: \"%s\"",
--- 155,161 ----
          }
          else
          {
!             if (source >= PGC_S_INTERACTIVE)
                  ereport(ERROR,
                          (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                           errmsg("unrecognized \"datestyle\" key word: \"%s\"",
***************
*** 173,179 ****

      if (!ok)
      {
!         if (interactive)
              ereport(ERROR,
                      (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                       errmsg("conflicting \"datestyle\" specifications")));
--- 173,179 ----

      if (!ok)
      {
!         if (source >= PGC_S_INTERACTIVE)
              ereport(ERROR,
                      (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                       errmsg("conflicting \"datestyle\" specifications")));
***************
*** 386,392 ****
   * assign_timezone: GUC assign_hook for timezone
   */
  const char *
! assign_timezone(const char *value, bool doit, bool interactive)
  {
      char       *result;
      char       *endptr;
--- 386,392 ----
   * assign_timezone: GUC assign_hook for timezone
   */
  const char *
! assign_timezone(const char *value, bool doit, GucSource source)
  {
      char       *result;
      char       *endptr;
***************
*** 444,450 ****
          pfree(val);
          if (interval->month != 0)
          {
!             if (interactive)
                  ereport(ERROR,
                          (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                           errmsg("invalid interval value for time zone: month not allowed")));
--- 444,450 ----
          pfree(val);
          if (interval->month != 0)
          {
!             if (source >= PGC_S_INTERACTIVE)
                  ereport(ERROR,
                          (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                           errmsg("invalid interval value for time zone: month not allowed")));
***************
*** 552,558 ****
                  /* Complain if it was bad */
                  if (!known)
                  {
!                     ereport(interactive ? ERROR : LOG,
                              (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                               errmsg("unrecognized time zone name: \"%s\"",
                                      value)));
--- 552,558 ----
                  /* Complain if it was bad */
                  if (!known)
                  {
!                     ereport((source >= PGC_S_INTERACTIVE) ? ERROR : LOG,
                              (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                               errmsg("unrecognized time zone name: \"%s\"",
                                      value)));
***************
*** 560,566 ****
                  }
                  if (!acceptable)
                  {
!                     ereport(interactive ? ERROR : LOG,
                              (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                      errmsg("time zone \"%s\" appears to use leap seconds",
                             value),
--- 560,566 ----
                  }
                  if (!acceptable)
                  {
!                     ereport((source >= PGC_S_INTERACTIVE) ? ERROR : LOG,
                              (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                      errmsg("time zone \"%s\" appears to use leap seconds",
                             value),
***************
*** 628,636 ****
   */

  const char *
! assign_XactIsoLevel(const char *value, bool doit, bool interactive)
  {
!     if (doit && interactive && SerializableSnapshot != NULL)
          ereport(ERROR,
                  (errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
                   errmsg("SET TRANSACTION ISOLATION LEVEL must be called before any query")));
--- 628,636 ----
   */

  const char *
! assign_XactIsoLevel(const char *value, bool doit, GucSource source)
  {
!     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")));
***************
*** 690,699 ****
   */

  bool
! assign_random_seed(double value, bool doit, bool interactive)
  {
      /* Can't really roll back on error, so ignore non-interactive setting */
!     if (doit && interactive)
          DirectFunctionCall1(setseed, Float8GetDatum(value));
      return true;
  }
--- 690,699 ----
   */

  bool
! assign_random_seed(double value, bool doit, GucSource source)
  {
      /* Can't really roll back on error, so ignore non-interactive setting */
!     if (doit && source >= PGC_S_INTERACTIVE)
          DirectFunctionCall1(setseed, Float8GetDatum(value));
      return true;
  }
***************
*** 710,716 ****
   */

  const char *
! assign_client_encoding(const char *value, bool doit, bool interactive)
  {
      int            encoding;

--- 710,716 ----
   */

  const char *
! assign_client_encoding(const char *value, bool doit, GucSource source)
  {
      int            encoding;

***************
*** 726,732 ****
       */
      if (SetClientEncoding(encoding, doit) < 0)
      {
!         if (interactive)
              ereport(ERROR,
                      (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                    errmsg("conversion between %s and %s is not supported",
--- 726,732 ----
       */
      if (SetClientEncoding(encoding, doit) < 0)
      {
!         if (source >= PGC_S_INTERACTIVE)
              ereport(ERROR,
                      (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                    errmsg("conversion between %s and %s is not supported",
***************
*** 748,754 ****
   * because of the NAMEDATALEN limit on names.
   */
  const char *
! assign_session_authorization(const char *value, bool doit, bool interactive)
  {
      AclId        usesysid = 0;
      bool        is_superuser = false;
--- 748,754 ----
   * because of the NAMEDATALEN limit on names.
   */
  const char *
! assign_session_authorization(const char *value, bool doit, GucSource source)
  {
      AclId        usesysid = 0;
      bool        is_superuser = false;
***************
*** 791,797 ****
                                   0, 0, 0);
          if (!HeapTupleIsValid(userTup))
          {
!             if (interactive)
                  ereport(ERROR,
                          (errcode(ERRCODE_UNDEFINED_OBJECT),
                           errmsg("user \"%s\" does not exist", value)));
--- 791,797 ----
                                   0, 0, 0);
          if (!HeapTupleIsValid(userTup))
          {
!             if (source >= PGC_S_INTERACTIVE)
                  ereport(ERROR,
                          (errcode(ERRCODE_UNDEFINED_OBJECT),
                           errmsg("user \"%s\" does not exist", value)));
*** src/backend/utils/adt/datetime.c.orig    Sun Dec 21 17:51:40 2003
--- src/backend/utils/adt/datetime.c    Mon Jan 19 13:04:49 2004
***************
*** 3919,3925 ****

  /* GUC assign_hook for australian_timezones */
  bool
! ClearDateCache(bool newval, bool doit, bool interactive)
  {
      int            i;

--- 3919,3925 ----

  /* GUC assign_hook for australian_timezones */
  bool
! ClearDateCache(bool newval, bool doit, GucSource source)
  {
      int            i;

*** src/backend/utils/adt/pg_locale.c.orig    Sat Nov 29 14:51:59 2003
--- src/backend/utils/adt/pg_locale.c    Mon Jan 19 13:25:56 2004
***************
*** 73,79 ****
   * valid.  (See explanation at the top of this file.)
   */
  static const char *
! locale_xxx_assign(int category, const char *value, bool doit, bool interactive)
  {
      char       *save;

--- 73,79 ----
   * valid.  (See explanation at the top of this file.)
   */
  static const char *
! locale_xxx_assign(int category, const char *value, bool doit, GucSource source)
  {
      char       *save;

***************
*** 99,119 ****


  const char *
! locale_monetary_assign(const char *value, bool doit, bool interactive)
  {
!     return locale_xxx_assign(LC_MONETARY, value, doit, interactive);
  }

  const char *
! locale_numeric_assign(const char *value, bool doit, bool interactive)
  {
!     return locale_xxx_assign(LC_NUMERIC, value, doit, interactive);
  }

  const char *
! locale_time_assign(const char *value, bool doit, bool interactive)
  {
!     return locale_xxx_assign(LC_TIME, value, doit, interactive);
  }


--- 99,119 ----


  const char *
! locale_monetary_assign(const char *value, bool doit, GucSource source)
  {
!     return locale_xxx_assign(LC_MONETARY, value, doit, source);
  }

  const char *
! locale_numeric_assign(const char *value, bool doit, GucSource source)
  {
!     return locale_xxx_assign(LC_NUMERIC, value, doit, source);
  }

  const char *
! locale_time_assign(const char *value, bool doit, GucSource source)
  {
!     return locale_xxx_assign(LC_TIME, value, doit, source);
  }


***************
*** 121,127 ****
   * We allow LC_MESSAGES to actually be set globally.
   */
  const char *
! locale_messages_assign(const char *value, bool doit, bool interactive)
  {
      /*
       * LC_MESSAGES category does not exist everywhere, but accept it
--- 121,127 ----
   * We allow LC_MESSAGES to actually be set globally.
   */
  const char *
! locale_messages_assign(const char *value, bool doit, GucSource source)
  {
      /*
       * LC_MESSAGES category does not exist everywhere, but accept it
***************
*** 134,140 ****
              return NULL;
      }
      else
!         value = locale_xxx_assign(LC_MESSAGES, value, false, interactive);
  #endif
      return value;
  }
--- 134,140 ----
              return NULL;
      }
      else
!         value = locale_xxx_assign(LC_MESSAGES, value, false, source);
  #endif
      return value;
  }
*** src/backend/utils/adt/regexp.c.orig    Sat Nov 29 14:51:59 2003
--- src/backend/utils/adt/regexp.c    Mon Jan 19 13:22:58 2004
***************
*** 32,37 ****
--- 32,38 ----
  #include "regex/regex.h"
  #include "mb/pg_wchar.h"
  #include "utils/builtins.h"
+ #include "utils/guc.h"


  /* GUC-settable flavor parameter */
***************
*** 229,235 ****
   */
  const char *
  assign_regex_flavor(const char *value,
!                     bool doit, bool interactive)
  {
      if (strcasecmp(value, "advanced") == 0)
      {
--- 230,236 ----
   */
  const char *
  assign_regex_flavor(const char *value,
!                     bool doit, GucSource source)
  {
      if (strcasecmp(value, "advanced") == 0)
      {
*** src/backend/utils/misc/README.orig    Sat Nov 29 14:52:03 2003
--- src/backend/utils/misc/README    Mon Jan 19 13:04:57 2004
***************
*** 19,47 ****
  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
  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.)

  For string variables, the signature for assign hooks is a bit different:
      const char *assign_hook(const char *newvalue,
                  bool doit,
!                 bool interactive)
  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)
--- 19,48 ----
  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, 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.  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,
!                 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)
*** src/backend/utils/misc/guc.c.orig    Tue Jan  6 12:58:35 2004
--- src/backend/utils/misc/guc.c    Mon Jan 19 13:37:01 2004
***************
*** 24,30 ****
  #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"
--- 24,29 ----
***************
*** 52,58 ****
  #include "tcop/tcopprot.h"
  #include "utils/array.h"
  #include "utils/builtins.h"
- #include "utils/datetime.h"
  #include "utils/pg_locale.h"
  #include "pgstat.h"

--- 51,56 ----
***************
*** 81,102 ****
  extern char *Syslog_ident;

  static const char *assign_facility(const char *facility,
!                 bool doit, bool interactive);
  #endif

  static const char *assign_defaultxactisolevel(const char *newval,
!                            bool doit, bool interactive);
  static const char *assign_log_min_messages(const char *newval,
!                         bool doit, bool interactive);
  static const char *assign_client_min_messages(const char *newval,
!                            bool doit, bool interactive);
  static const char *assign_min_error_statement(const char *newval, bool doit,
!                            bool interactive);
  static const char *assign_msglvl(int *var, const char *newval,
!               bool doit, bool interactive);
  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);


  /*
--- 79,100 ----
  extern char *Syslog_ident;

  static const char *assign_facility(const char *facility,
!                 bool doit, GucSource source);
  #endif

  static const char *assign_defaultxactisolevel(const char *newval,
!                            bool doit, GucSource source);
  static const char *assign_log_min_messages(const char *newval,
!                         bool doit, GucSource source);
  static const char *assign_client_min_messages(const char *newval,
!                            bool doit, GucSource source);
  static const char *assign_min_error_statement(const char *newval, bool doit,
!                            GucSource source);
  static const char *assign_msglvl(int *var, const char *newval,
!               bool doit, GucSource source);
  static const char *assign_log_error_verbosity(const char *newval, bool doit,
!                            GucSource source);
! static bool assign_phony_autocommit(bool newval, bool doit, GucSource source);


  /*
***************
*** 227,242 ****
   */
  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"
  };

  /*
--- 225,242 ----
   */
  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_INTERACTIVE */ "interactive",
!     /* PGC_S_TEST */ "test",
!     /* PGC_S_SESSION */ "session"
  };

  /*
***************
*** 1893,1899 ****
                      struct config_bool *conf = (struct config_bool *) gconf;

                      if (conf->assign_hook)
!                         if (!(*conf->assign_hook) (conf->reset_val, true, false))
                              elog(FATAL, "failed to initialize %s to %d",
                                   conf->gen.name, (int) conf->reset_val);
                      *conf->variable = conf->reset_val;
--- 1893,1900 ----
                      struct config_bool *conf = (struct config_bool *) gconf;

                      if (conf->assign_hook)
!                         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;
***************
*** 1914,1920 ****
                      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))
                              elog(FATAL, "failed to initialize %s to %d",
                                   conf->gen.name, conf->reset_val);
                      *conf->variable = conf->reset_val;
--- 1915,1922 ----
                      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,
!                                                    PGC_S_DEFAULT))
                              elog(FATAL, "failed to initialize %s to %d",
                                   conf->gen.name, conf->reset_val);
                      *conf->variable = conf->reset_val;
***************
*** 1929,1935 ****
                      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))
                              elog(FATAL, "failed to initialize %s to %g",
                                   conf->gen.name, conf->reset_val);
                      *conf->variable = conf->reset_val;
--- 1931,1938 ----
                      Assert(conf->reset_val <= conf->max);
                      Assert(conf->gen.context != PGC_USERLIMIT);
                      if (conf->assign_hook)
!                         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;
***************
*** 1971,1977 ****
                      {
                          const char *newstr;

!                         newstr = (*conf->assign_hook) (str, true, false);
                          if (newstr == NULL)
                          {
                              elog(FATAL, "failed to initialize %s to \"%s\"",
--- 1974,1981 ----
                      {
                          const char *newstr;

!                         newstr = (*conf->assign_hook) (str, true,
!                                                        PGC_S_DEFAULT);
                          if (newstr == NULL)
                          {
                              elog(FATAL, "failed to initialize %s to \"%s\"",
***************
*** 2065,2071 ****
                      struct config_bool *conf = (struct config_bool *) gconf;

                      if (conf->assign_hook)
!                         if (!(*conf->assign_hook) (conf->reset_val, true, true))
                              elog(ERROR, "failed to reset %s", conf->gen.name);
                      *conf->variable = conf->reset_val;
                      conf->tentative_val = conf->reset_val;
--- 2069,2076 ----
                      struct config_bool *conf = (struct config_bool *) gconf;

                      if (conf->assign_hook)
!                         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;
***************
*** 2080,2086 ****
                      struct config_int *conf = (struct config_int *) gconf;

                      if (conf->assign_hook)
!                         if (!(*conf->assign_hook) (conf->reset_val, true, true))
                              elog(ERROR, "failed to reset %s", conf->gen.name);
                      *conf->variable = conf->reset_val;
                      conf->tentative_val = conf->reset_val;
--- 2085,2092 ----
                      struct config_int *conf = (struct config_int *) gconf;

                      if (conf->assign_hook)
!                         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;
***************
*** 2095,2101 ****
                      struct config_real *conf = (struct config_real *) gconf;

                      if (conf->assign_hook)
!                         if (!(*conf->assign_hook) (conf->reset_val, true, true))
                              elog(ERROR, "failed to reset %s", conf->gen.name);
                      *conf->variable = conf->reset_val;
                      conf->tentative_val = conf->reset_val;
--- 2101,2108 ----
                      struct config_real *conf = (struct config_real *) gconf;

                      if (conf->assign_hook)
!                         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;
***************
*** 2123,2129 ****
                      {
                          const char *newstr;

!                         newstr = (*conf->assign_hook) (str, true, true);
                          if (newstr == NULL)
                              elog(ERROR, "failed to reset %s", conf->gen.name);
                          else if (newstr != str)
--- 2130,2137 ----
                      {
                          const char *newstr;

!                         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)
***************
*** 2198,2204 ****
                      {
                          if (conf->assign_hook)
                              if (!(*conf->assign_hook) (conf->session_val,
!                                                        true, false))
                                  elog(LOG, "failed to commit %s",
                                       conf->gen.name);
                          *conf->variable = conf->session_val;
--- 2206,2212 ----
                      {
                          if (conf->assign_hook)
                              if (!(*conf->assign_hook) (conf->session_val,
!                                                        true, PGC_S_OVERRIDE))
                                  elog(LOG, "failed to commit %s",
                                       conf->gen.name);
                          *conf->variable = conf->session_val;
***************
*** 2222,2228 ****
                      {
                          if (conf->assign_hook)
                              if (!(*conf->assign_hook) (conf->session_val,
!                                                        true, false))
                                  elog(LOG, "failed to commit %s",
                                       conf->gen.name);
                          *conf->variable = conf->session_val;
--- 2230,2236 ----
                      {
                          if (conf->assign_hook)
                              if (!(*conf->assign_hook) (conf->session_val,
!                                                        true, PGC_S_OVERRIDE))
                                  elog(LOG, "failed to commit %s",
                                       conf->gen.name);
                          *conf->variable = conf->session_val;
***************
*** 2246,2252 ****
                      {
                          if (conf->assign_hook)
                              if (!(*conf->assign_hook) (conf->session_val,
!                                                        true, false))
                                  elog(LOG, "failed to commit %s",
                                       conf->gen.name);
                          *conf->variable = conf->session_val;
--- 2254,2260 ----
                      {
                          if (conf->assign_hook)
                              if (!(*conf->assign_hook) (conf->session_val,
!                                                        true, PGC_S_OVERRIDE))
                                  elog(LOG, "failed to commit %s",
                                       conf->gen.name);
                          *conf->variable = conf->session_val;
***************
*** 2277,2283 ****
                          {
                              const char *newstr;

!                             newstr = (*conf->assign_hook) (str, true, false);
                              if (newstr == NULL)
                                  elog(LOG, "failed to commit %s",
                                       conf->gen.name);
--- 2285,2292 ----
                          {
                              const char *newstr;

!                             newstr = (*conf->assign_hook) (str, true,
!                                                            PGC_S_OVERRIDE);
                              if (newstr == NULL)
                                  elog(LOG, "failed to commit %s",
                                       conf->gen.name);
***************
*** 2500,2506 ****
  {
      struct config_generic *record;
      int            elevel;
-     bool        interactive;
      bool        makeDefault;
      bool        changeVal_orig;

--- 2509,2514 ----
***************
*** 2610,2618 ****
              break;
      }

-     /* Should we report errors interactively? */
-     interactive = (source >= PGC_S_SESSION);
-
      /*
       * Should we set reset/session values?    (If so, the behavior is not
       * transactional.)
--- 2618,2623 ----
***************
*** 2687,2693 ****
                  }

                  if (conf->assign_hook)
!                     if (!(*conf->assign_hook) (newval, changeVal, interactive))
                      {
                          ereport(elevel,
                                  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
--- 2692,2698 ----
                  }

                  if (conf->assign_hook)
!                     if (!(*conf->assign_hook) (newval, changeVal, source))
                      {
                          ereport(elevel,
                                  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
***************
*** 2784,2790 ****
                  }

                  if (conf->assign_hook)
!                     if (!(*conf->assign_hook) (newval, changeVal, interactive))
                      {
                          ereport(elevel,
                                  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
--- 2789,2795 ----
                  }

                  if (conf->assign_hook)
!                     if (!(*conf->assign_hook) (newval, changeVal, source))
                      {
                          ereport(elevel,
                                  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
***************
*** 2880,2886 ****
                  }

                  if (conf->assign_hook)
!                     if (!(*conf->assign_hook) (newval, changeVal, interactive))
                      {
                          ereport(elevel,
                                  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
--- 2885,2891 ----
                  }

                  if (conf->assign_hook)
!                     if (!(*conf->assign_hook) (newval, changeVal, source))
                      {
                          ereport(elevel,
                                  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
***************
*** 2949,2957 ****

                          /* all USERLIMIT strings are message levels */
                          assign_msglvl(&old_int_value, conf->reset_val,
!                                       true, interactive);
                          assign_msglvl(&new_int_value, newval,
!                                       true, interactive);
                          /* Limit non-superuser changes */
                          if (source > PGC_S_UNPRIVILEGED &&
                              new_int_value > old_int_value &&
--- 2954,2962 ----

                          /* all USERLIMIT strings are message levels */
                          assign_msglvl(&old_int_value, conf->reset_val,
!                                       true, source);
                          assign_msglvl(&new_int_value, newval,
!                                       true, source);
                          /* Limit non-superuser changes */
                          if (source > PGC_S_UNPRIVILEGED &&
                              new_int_value > old_int_value &&
***************
*** 3008,3014 ****
                      const char *hookresult;

                      hookresult = (*conf->assign_hook) (newval,
!                                                        changeVal, interactive);
                      guc_string_workspace = NULL;
                      if (hookresult == NULL)
                      {
--- 3013,3019 ----
                      const char *hookresult;

                      hookresult = (*conf->assign_hook) (newval,
!                                                        changeVal, source);
                      guc_string_workspace = NULL;
                      if (hookresult == NULL)
                      {
***************
*** 4189,4195 ****
      /* test if the option is valid */
      set_config_option(name, value,
                        superuser() ? PGC_SUSET : PGC_USERSET,
!                       PGC_S_SESSION, false, false);

      /* convert name to canonical spelling, so we can use plain strcmp */
      (void) GetConfigOptionByName(name, &varname);
--- 4194,4200 ----
      /* test if the option is valid */
      set_config_option(name, value,
                        superuser() ? PGC_SUSET : PGC_USERSET,
!                       PGC_S_TEST, false, false);

      /* convert name to canonical spelling, so we can use plain strcmp */
      (void) GetConfigOptionByName(name, &varname);
***************
*** 4268,4274 ****
      /* test if the option is valid */
      set_config_option(name, NULL,
                        superuser() ? PGC_SUSET : PGC_USERSET,
!                       PGC_S_SESSION, false, false);

      /* convert name to canonical spelling, so we can use plain strcmp */
      (void) GetConfigOptionByName(name, &varname);
--- 4273,4279 ----
      /* test if the option is valid */
      set_config_option(name, NULL,
                        superuser() ? PGC_SUSET : PGC_USERSET,
!                       PGC_S_TEST, false, false);

      /* convert name to canonical spelling, so we can use plain strcmp */
      (void) GetConfigOptionByName(name, &varname);
***************
*** 4333,4339 ****
  #ifdef HAVE_SYSLOG

  static const char *
! assign_facility(const char *facility, bool doit, bool interactive)
  {
      if (strcasecmp(facility, "LOCAL0") == 0)
          return facility;
--- 4338,4344 ----
  #ifdef HAVE_SYSLOG

  static const char *
! assign_facility(const char *facility, bool doit, GucSource source)
  {
      if (strcasecmp(facility, "LOCAL0") == 0)
          return facility;
***************
*** 4357,4363 ****


  static const char *
! assign_defaultxactisolevel(const char *newval, bool doit, bool interactive)
  {
      if (strcasecmp(newval, "serializable") == 0)
      {
--- 4362,4368 ----


  static const char *
! assign_defaultxactisolevel(const char *newval, bool doit, GucSource source)
  {
      if (strcasecmp(newval, "serializable") == 0)
      {
***************
*** 4386,4411 ****

  static const char *
  assign_log_min_messages(const char *newval,
!                         bool doit, bool interactive)
  {
!     return (assign_msglvl(&log_min_messages, newval, doit, interactive));
  }

  static const char *
  assign_client_min_messages(const char *newval,
!                            bool doit, bool interactive)
  {
!     return (assign_msglvl(&client_min_messages, newval, doit, interactive));
  }

  static const char *
! assign_min_error_statement(const char *newval, bool doit, bool interactive)
  {
!     return (assign_msglvl(&log_min_error_statement, newval, doit, interactive));
  }

  static const char *
! assign_msglvl(int *var, const char *newval, bool doit, bool interactive)
  {
      if (strcasecmp(newval, "debug") == 0)
      {
--- 4391,4416 ----

  static const char *
  assign_log_min_messages(const char *newval,
!                         bool doit, GucSource source)
  {
!     return (assign_msglvl(&log_min_messages, newval, doit, source));
  }

  static const char *
  assign_client_min_messages(const char *newval,
!                            bool doit, GucSource source)
  {
!     return (assign_msglvl(&client_min_messages, newval, doit, source));
  }

  static const char *
! assign_min_error_statement(const char *newval, bool doit, GucSource source)
  {
!     return (assign_msglvl(&log_min_error_statement, newval, doit, source));
  }

  static const char *
! assign_msglvl(int *var, const char *newval, bool doit, GucSource source)
  {
      if (strcasecmp(newval, "debug") == 0)
      {
***************
*** 4479,4485 ****
  }

  static const char *
! assign_log_error_verbosity(const char *newval, bool doit, bool interactive)
  {
      if (strcasecmp(newval, "terse") == 0)
      {
--- 4484,4490 ----
  }

  static const char *
! assign_log_error_verbosity(const char *newval, bool doit, GucSource source)
  {
      if (strcasecmp(newval, "terse") == 0)
      {
***************
*** 4502,4512 ****
  }

  static bool
! assign_phony_autocommit(bool newval, bool doit, bool interactive)
  {
      if (!newval)
      {
!         if (doit && interactive)
              ereport(ERROR,
                      (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                  errmsg("SET AUTOCOMMIT TO OFF is no longer supported")));
--- 4507,4517 ----
  }

  static bool
! assign_phony_autocommit(bool newval, bool doit, GucSource source)
  {
      if (!newval)
      {
!         if (doit && source >= PGC_S_INTERACTIVE)
              ereport(ERROR,
                      (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                  errmsg("SET AUTOCOMMIT TO OFF is no longer supported")));
*** src/include/access/xlog.h.orig    Tue Jan  6 12:58:43 2004
--- src/include/access/xlog.h    Mon Jan 19 13:20:53 2004
***************
*** 222,228 ****
   */
  extern XLogRecPtr GetUndoRecPtr(void);

- extern const char *assign_xlog_sync_method(const char *method,
-                         bool doit, bool interactive);
-
  #endif   /* XLOG_H */
--- 222,225 ----
*** src/include/catalog/namespace.h.orig    Sat Nov 29 17:40:58 2003
--- src/include/catalog/namespace.h    Mon Jan 19 13:18:29 2004
***************
*** 95,103 ****
  /* 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 */
--- 95,100 ----
*** src/include/commands/variable.h.orig    Sat Nov 29 17:40:59 2003
--- src/include/commands/variable.h    Mon Jan 19 13:13:32 2004
***************
*** 2,28 ****
   * variable.h
   *        Routines for handling specialized SET variables.
   *
!  * $PostgreSQL: pgsql-server/src/include/commands/variable.h,v 1.22 2003/11/29 22:40:59 pgsql Exp $
   *
   */
  #ifndef VARIABLE_H
  #define VARIABLE_H

  extern const char *assign_datestyle(const char *value,
!                  bool doit, bool interactive);
  extern const char *assign_timezone(const char *value,
!                 bool doit, bool interactive);
  extern const char *show_timezone(void);
  extern const char *assign_XactIsoLevel(const char *value,
!                     bool doit, bool interactive);
  extern const char *show_XactIsoLevel(void);
  extern bool assign_random_seed(double value,
!                    bool doit, bool interactive);
  extern const char *show_random_seed(void);
  extern const char *assign_client_encoding(const char *value,
!                        bool doit, bool interactive);
  extern const char *assign_session_authorization(const char *value,
!                              bool doit, bool interactive);
  extern const char *show_session_authorization(void);

  #endif   /* VARIABLE_H */
--- 2,33 ----
   * variable.h
   *        Routines for handling specialized SET variables.
   *
!  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
!  * Portions Copyright (c) 1994, Regents of the University of California
   *
+  * $PostgreSQL: pgsql-server/src/include/commands/variable.h,v 1.22 2003/11/29 22:40:59 pgsql Exp $
   */
  #ifndef VARIABLE_H
  #define VARIABLE_H

+ #include "utils/guc.h"
+
+
  extern const char *assign_datestyle(const char *value,
!                  bool doit, GucSource source);
  extern const char *assign_timezone(const char *value,
!                 bool doit, GucSource source);
  extern const char *show_timezone(void);
  extern const char *assign_XactIsoLevel(const char *value,
!                     bool doit, GucSource source);
  extern const char *show_XactIsoLevel(void);
  extern bool assign_random_seed(double value,
!                    bool doit, GucSource source);
  extern const char *show_random_seed(void);
  extern const char *assign_client_encoding(const char *value,
!                        bool doit, GucSource source);
  extern const char *assign_session_authorization(const char *value,
!                              bool doit, GucSource source);
  extern const char *show_session_authorization(void);

  #endif   /* VARIABLE_H */
*** src/include/utils/builtins.h.orig    Mon Dec  1 18:21:18 2003
--- src/include/utils/builtins.h    Mon Jan 19 13:16:08 2004
***************
*** 16,22 ****

  #include "fmgr.h"
  #include "nodes/parsenodes.h"
- #include "storage/itemptr.h"    /* for setLastTid() */

  /*
   *        Defined in adt/
--- 16,21 ----
***************
*** 415,422 ****
  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);
--- 414,419 ----
***************
*** 483,489 ****
  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);
--- 480,485 ----
*** src/include/utils/datetime.h.orig    Sat Nov 29 17:41:15 2003
--- src/include/utils/datetime.h    Mon Jan 19 13:08:46 2004
***************
*** 318,324 ****

  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);

--- 318,323 ----
*** src/include/utils/guc.h.orig    Mon Dec  1 17:29:31 2003
--- src/include/utils/guc.h    Mon Jan 19 13:20:42 2004
***************
*** 76,81 ****
--- 76,90 ----
   *
   * 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,93 ****
--- 97,104 ----
      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;

***************
*** 151,155 ****
--- 162,184 ----
  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 */
*** src/include/utils/guc_tables.h.orig    Fri Dec  5 23:42:25 2003
--- src/include/utils/guc_tables.h    Mon Jan 19 13:04:41 2004
***************
*** 113,119 ****
      /* (all but reset_val are constants) */
      bool       *variable;
      bool        reset_val;
!     bool        (*assign_hook) (bool newval, bool doit, bool interactive);
      const char *(*show_hook) (void);
      /* variable fields, initialized at runtime: */
      bool        session_val;
--- 113,119 ----
      /* (all but reset_val are constants) */
      bool       *variable;
      bool        reset_val;
!     bool        (*assign_hook) (bool newval, bool doit, GucSource source);
      const char *(*show_hook) (void);
      /* variable fields, initialized at runtime: */
      bool        session_val;
***************
*** 129,135 ****
      int            reset_val;
      int            min;
      int            max;
!     bool        (*assign_hook) (int newval, bool doit, bool interactive);
      const char *(*show_hook) (void);
      /* variable fields, initialized at runtime: */
      int            session_val;
--- 129,135 ----
      int            reset_val;
      int            min;
      int            max;
!     bool        (*assign_hook) (int newval, bool doit, GucSource source);
      const char *(*show_hook) (void);
      /* variable fields, initialized at runtime: */
      int            session_val;
***************
*** 145,151 ****
      double        reset_val;
      double        min;
      double        max;
!     bool        (*assign_hook) (double newval, bool doit, bool interactive);
      const char *(*show_hook) (void);
      /* variable fields, initialized at runtime: */
      double        session_val;
--- 145,151 ----
      double        reset_val;
      double        min;
      double        max;
!     bool        (*assign_hook) (double newval, bool doit, GucSource source);
      const char *(*show_hook) (void);
      /* variable fields, initialized at runtime: */
      double        session_val;
***************
*** 159,165 ****
      /* (all are constants) */
      char      **variable;
      const char *boot_val;
!     const char *(*assign_hook) (const char *newval, bool doit, bool interactive);
      const char *(*show_hook) (void);
      /* variable fields, initialized at runtime: */
      char       *reset_val;
--- 159,165 ----
      /* (all are constants) */
      char      **variable;
      const char *boot_val;
!     const char *(*assign_hook) (const char *newval, bool doit, GucSource source);
      const char *(*show_hook) (void);
      /* variable fields, initialized at runtime: */
      char       *reset_val;
*** src/include/utils/pg_locale.h.orig    Sat Nov 29 17:41:16 2003
--- src/include/utils/pg_locale.h    Mon Jan 19 13:13:26 2004
***************
*** 14,32 ****

  #include <locale.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);
  extern const char *locale_monetary_assign(const char *value,
!                        bool doit, bool interactive);
  extern const char *locale_numeric_assign(const char *value,
!                       bool doit, bool interactive);
  extern const char *locale_time_assign(const char *value,
!                    bool doit, bool interactive);

  extern bool lc_collate_is_c(void);

--- 14,35 ----

  #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, GucSource source);
  extern const char *locale_monetary_assign(const char *value,
!                        bool doit, GucSource source);
  extern const char *locale_numeric_assign(const char *value,
!                       bool doit, GucSource source);
  extern const char *locale_time_assign(const char *value,
!                    bool doit, GucSource source);

  extern bool lc_collate_is_c(void);

*** src/interfaces/ecpg/pgtypeslib/dt.h.orig    Sun Dec 21 17:54:03 2003
--- src/interfaces/ecpg/pgtypeslib/dt.h    Mon Jan 19 13:04:32 2004
***************
*** 298,304 ****
  int            tm2timestamp(struct tm *, fsec_t, int *, timestamp *);

  int            DecodeUnits(int field, char *lowtoken, int *val);
- bool        ClearDateCache(bool, bool, bool);

  bool        CheckDateTokenTables(void);

--- 298,303 ----

Re: Patch for search_path --- apply to 7.4 branch?

From
ohp@pyrenet.fr
Date:
Hi Tom,

I'd love to see it in a 7.4.2... With maybe the patch for SMP...

Regards
On Mon, 19 Jan 2004, Tom Lane wrote:

> Date: Mon, 19 Jan 2004 14:15:08 -0500
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: pgsql-patches@postgreSQL.org
> Subject: [PATCHES] Patch for search_path --- apply to 7.4 branch?
>
> Attached is the patch I just applied to CVS HEAD to fix the search_path
> problem that Olivier Prenant recently identified (can't set a search
> path for another database if it mentions schemas not present in the
> current database).  I am looking for comments on whether to back-patch
> this into REL7_4_STABLE.  It is a rather large patch to fix what might
> be considered a non-critical problem, so I'm a bit hesitant about back
> patching.  Any opinions?
>
>             regards, tom lane
>
>

--
Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
6, Chemin d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)

Re: Patch for search_path --- apply to 7.4 branch?

From
Neil Conway
Date:
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Attached is the patch I just applied to CVS HEAD to fix the
> search_path problem that Olivier Prenant recently identified (can't
> set a search path for another database if it mentions schemas not
> present in the current database).  I am looking for comments on
> whether to back-patch this into REL7_4_STABLE.

The patch looks pretty safe to me: while it touches a fair number of
places, most of the changes are just search-and-replace stuff, not
actual logic changes. I wouldn't have a problem with this being
applied to the 7.4 branch.

-Neil