Robert Haas wrote:
> On Wed, May 11, 2011 at 2:18 PM, Tom Lane <[email protected]> wrote:
> > Or you could just "unsetenv" instead of complaining.
>
> +1 for that.
OK, the attached patch does this, but allows PGCLIENTENCODING to be
passed in. The new output looks like:
Performing Consistency Checks
-----------------------------
ignoring libpq environment variable PGPORT
Checking old data directory (/u/pgsql.old/data) ok
Checking old bin directory (/u/pgsql.old/bin) ok
Checking new data directory (/u/pgsql/data) ok
Checking new bin directory (/u/pgsql/bin) ok
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
diff --git a/contrib/pg_upgrade/server.c b/contrib/pg_upgrade/server.c
new file mode 100644
index 8fce305..bf30dcd
*** a/contrib/pg_upgrade/server.c
--- b/contrib/pg_upgrade/server.c
*************** check_for_libpq_envvars(void)
*** 254,260 ****
{
PQconninfoOption *option;
PQconninfoOption *start;
- bool found = false;
/* Get valid libpq env vars from the PQconndefaults function */
--- 254,259 ----
*************** check_for_libpq_envvars(void)
*** 264,290 ****
{
if (option->envvar)
{
! const char *value;
/* This allows us to see error messages in the local encoding */
if (strcmp(option->envvar, "PGCLIENTENCODING") == 0)
continue;
- value = getenv(option->envvar);
if (value && strlen(value) > 0)
{
! found = true;
!
pg_log(PG_WARNING,
! "libpq env var %-20s is currently set to: %s\n", option->envvar, value);
}
}
}
/* Free the memory that libpq allocated on our behalf */
PQconninfoFree(start);
-
- if (found)
- pg_log(PG_FATAL,
- "libpq env vars have been found and listed above, please unset them for pg_upgrade\n");
}
--- 263,287 ----
{
if (option->envvar)
{
! const char *value = getenv(option->envvar);
/* This allows us to see error messages in the local encoding */
if (strcmp(option->envvar, "PGCLIENTENCODING") == 0)
continue;
if (value && strlen(value) > 0)
{
! #ifndef WIN32
! unsetenv(option->envvar);
! #else
! SetEnvironmentVariableA(option->envvar, "");
! #endif
pg_log(PG_WARNING,
! "ignoring libpq environment variable %s\n", option->envvar);
}
}
}
/* Free the memory that libpq allocated on our behalf */
PQconninfoFree(start);
}
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers