diff options
| author | Tom Lane | 2008-11-25 19:30:42 +0000 |
|---|---|---|
| committer | Tom Lane | 2008-11-25 19:30:42 +0000 |
| commit | 1304f297a44516857cf404742487da0ed6344fdb (patch) | |
| tree | bf6bd04857a793848c760dc8c51ed4c8d24de32d /src/test | |
| parent | 4d1ba044d897be5bc85adbb9d6b8b4e5976b4e44 (diff) | |
Remove PGINTERVALSTYLE from the set of special environment variables for
libpq. As noted by Peter, adding this variable created a risk of unexpected
connection failures when talking to older server versions, and since it
doesn't do anything you can't do with PGOPTIONS, it doesn't seem really
necessary. Removing it does occasion a few extra lines in pg_regress.c,
but saving a getenv() call per libpq connection attempt is perhaps worth
that anyway.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/pg_regress.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index d063602c7e6..f64e00b643f 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.51 2008/11/25 11:49:35 petere Exp $ + * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.52 2008/11/25 19:30:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -716,7 +716,23 @@ initialize_environment(void) */ putenv("PGTZ=PST8PDT"); putenv("PGDATESTYLE=Postgres, MDY"); - putenv("PGINTERVALSTYLE=postgres_verbose"); + + /* + * Likewise set intervalstyle to ensure consistent results. This is a + * bit more painful because we must use PGOPTIONS, and we want to preserve + * the user's ability to set other variables through that. + */ + { + const char *my_pgoptions = "--intervalstyle=postgres_verbose"; + const char *old_pgoptions = getenv("PGOPTIONS"); + char *new_pgoptions; + + if (!old_pgoptions) + old_pgoptions = ""; + new_pgoptions = malloc(strlen(old_pgoptions) + strlen(my_pgoptions) + 12); + sprintf(new_pgoptions, "PGOPTIONS=%s %s", old_pgoptions, my_pgoptions); + putenv(new_pgoptions); + } if (temp_install) { |
