diff options
author | Tom Lane | 2008-11-25 19:30:42 +0000 |
---|---|---|
committer | Tom Lane | 2008-11-25 19:30:42 +0000 |
commit | 4c3928754210de3b854f8f09ac0efb5fe7333407 (patch) | |
tree | c47c415ef5a2da0959aca0f3ec99cf9e0e5d9f39 | |
parent | 6124caedd0be321117ddeac9b4d6deff9afc134f (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.
-rw-r--r-- | doc/src/sgml/libpq.sgml | 11 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 3 | ||||
-rw-r--r-- | src/test/regress/pg_regress.c | 18 |
3 files changed, 17 insertions, 15 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 554471f527..cebeb04672 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -5823,17 +5823,6 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough) <listitem> <para> <indexterm> - <primary><envar>PGINTERVALSTYLE</envar></primary> - </indexterm> - <envar>PGINTERVALSTYLE</envar> sets the default style of interval - representation. (Equivalent to <literal>SET intervalstyle TO - ...</literal>.) - </para> - </listitem> - - <listitem> - <para> - <indexterm> <primary><envar>PGTZ</envar></primary> </indexterm> <envar>PGTZ</envar> sets the default time zone. (Equivalent to diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 05fd094b1c..5b8e84744f 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -214,9 +214,6 @@ static const PQEnvironmentOption EnvironmentOptions[] = "PGDATESTYLE", "datestyle" }, { - "PGINTERVALSTYLE", "intervalstyle" - }, - { "PGTZ", "timezone" }, { diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index bb17fa278c..d7c4847c92 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -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) { |