diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-07-15 19:19:56 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-07-15 19:19:56 +0000 |
commit | cfa6999d3b1bdcaa058c90392057a044b0f067e8 (patch) | |
tree | 90ef7c28ad711dc77543ef3d954528c6949ae000 /src | |
parent | 274328c8a88319f0a16d57c82128ee80ac26e578 (diff) | |
download | postgresql-cfa6999d3b1bdcaa058c90392057a044b0f067e8.tar.gz postgresql-cfa6999d3b1bdcaa058c90392057a044b0f067e8.zip |
Cause SHOW DATESTYLE to produce a string that will be accepted by SET
DATESTYLE, for instance 'SQL, European' instead of
'SQL with European conventions'. Per gripe a month or two back from
Barry Lind.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/variable.c | 40 | ||||
-rw-r--r-- | src/backend/utils/misc/guc.c | 4 | ||||
-rw-r--r-- | src/include/commands/variable.h | 3 | ||||
-rw-r--r-- | src/test/regress/expected/horology-no-DST-before-1970.out | 30 | ||||
-rw-r--r-- | src/test/regress/expected/horology-solaris-1947.out | 30 | ||||
-rw-r--r-- | src/test/regress/expected/horology.out | 30 |
6 files changed, 53 insertions, 84 deletions
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index 3dd4724f774..cc32ada4a45 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.79 2003/06/27 19:08:37 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.80 2003/07/15 19:19:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -90,7 +90,7 @@ assign_datestyle(const char *value, bool doit, bool interactive) newDateStyle = USE_SQL_DATES; dcnt++; } - else if (strncasecmp(tok, "POSTGRESQL", 8) == 0) + else if (strncasecmp(tok, "POSTGRES", 8) == 0) { newDateStyle = USE_POSTGRES_DATES; dcnt++; @@ -190,13 +190,13 @@ assign_datestyle(const char *value, bool doit, bool interactive) strcpy(result, "SQL"); break; case USE_GERMAN_DATES: - strcpy(result, "GERMAN"); + strcpy(result, "German"); break; default: - strcpy(result, "POSTGRESQL"); + strcpy(result, "Postgres"); break; } - strcat(result, newEuroDates ? ", EURO" : ", US"); + strcat(result, newEuroDates ? ", European" : ", US"); /* * Finally, it's safe to assign to the global variables; the @@ -208,36 +208,6 @@ assign_datestyle(const char *value, bool doit, bool interactive) return result; } -/* - * show_datestyle: GUC show_hook for datestyle - */ -const char * -show_datestyle(void) -{ - static char buf[64]; - - switch (DateStyle) - { - case USE_ISO_DATES: - strcpy(buf, "ISO"); - break; - case USE_SQL_DATES: - strcpy(buf, "SQL"); - break; - case USE_GERMAN_DATES: - strcpy(buf, "German"); - break; - default: - strcpy(buf, "Postgres"); - break; - }; - strcat(buf, " with "); - strcat(buf, ((EuroDates) ? "European" : "US (NonEuropean)")); - strcat(buf, " conventions"); - - return buf; -} - /* * TIMEZONE diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 2769abd87e4..8138c46918d 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.136 2003/07/09 08:51:19 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.137 2003/07/15 19:19:56 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -1265,7 +1265,7 @@ static struct config_string ConfigureNamesString[] = GUC_LIST_INPUT | GUC_REPORT }, &datestyle_string, - "ISO, US", assign_datestyle, show_datestyle + "ISO, US", assign_datestyle, NULL }, { diff --git a/src/include/commands/variable.h b/src/include/commands/variable.h index 68a0ebf7450..fda1d9f0e56 100644 --- a/src/include/commands/variable.h +++ b/src/include/commands/variable.h @@ -2,7 +2,7 @@ * variable.h * Routines for handling specialized SET variables. * - * $Id: variable.h,v 1.20 2003/04/25 19:45:09 tgl Exp $ + * $Id: variable.h,v 1.21 2003/07/15 19:19:56 tgl Exp $ * */ #ifndef VARIABLE_H @@ -10,7 +10,6 @@ extern const char *assign_datestyle(const char *value, bool doit, bool interactive); -extern const char *show_datestyle(void); extern const char *assign_timezone(const char *value, bool doit, bool interactive); extern const char *show_timezone(void); diff --git a/src/test/regress/expected/horology-no-DST-before-1970.out b/src/test/regress/expected/horology-no-DST-before-1970.out index a5edd6103f1..1ad38e34861 100644 --- a/src/test/regress/expected/horology-no-DST-before-1970.out +++ b/src/test/regress/expected/horology-no-DST-before-1970.out @@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP; -- SET DateStyle TO 'US,Postgres'; SHOW DateStyle; - DateStyle --------------------------------------------- - Postgres with US (NonEuropean) conventions + DateStyle +-------------- + Postgres, US (1 row) SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; @@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; SET DateStyle TO 'US,SQL'; SHOW DateStyle; - DateStyle ---------------------------------------- - SQL with US (NonEuropean) conventions + DateStyle +----------- + SQL, US (1 row) SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; @@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; SET DateStyle TO 'European,Postgres'; SHOW DateStyle; - DateStyle ------------------------------------- - Postgres with European conventions + DateStyle +-------------------- + Postgres, European (1 row) INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957'); @@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; SET DateStyle TO 'European,ISO'; SHOW DateStyle; - DateStyle -------------------------------- - ISO with European conventions + DateStyle +--------------- + ISO, European (1 row) SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; @@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; SET DateStyle TO 'European,SQL'; SHOW DateStyle; - DateStyle -------------------------------- - SQL with European conventions + DateStyle +--------------- + SQL, European (1 row) SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; diff --git a/src/test/regress/expected/horology-solaris-1947.out b/src/test/regress/expected/horology-solaris-1947.out index ea64e96beed..31619de8fd9 100644 --- a/src/test/regress/expected/horology-solaris-1947.out +++ b/src/test/regress/expected/horology-solaris-1947.out @@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP; -- SET DateStyle TO 'US,Postgres'; SHOW DateStyle; - DateStyle --------------------------------------------- - Postgres with US (NonEuropean) conventions + DateStyle +-------------- + Postgres, US (1 row) SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; @@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; SET DateStyle TO 'US,SQL'; SHOW DateStyle; - DateStyle ---------------------------------------- - SQL with US (NonEuropean) conventions + DateStyle +----------- + SQL, US (1 row) SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; @@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; SET DateStyle TO 'European,Postgres'; SHOW DateStyle; - DateStyle ------------------------------------- - Postgres with European conventions + DateStyle +-------------------- + Postgres, European (1 row) INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957'); @@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; SET DateStyle TO 'European,ISO'; SHOW DateStyle; - DateStyle -------------------------------- - ISO with European conventions + DateStyle +--------------- + ISO, European (1 row) SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; @@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; SET DateStyle TO 'European,SQL'; SHOW DateStyle; - DateStyle -------------------------------- - SQL with European conventions + DateStyle +--------------- + SQL, European (1 row) SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out index 084f9fe2a64..174dc9cdc0d 100644 --- a/src/test/regress/expected/horology.out +++ b/src/test/regress/expected/horology.out @@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP; -- SET DateStyle TO 'US,Postgres'; SHOW DateStyle; - DateStyle --------------------------------------------- - Postgres with US (NonEuropean) conventions + DateStyle +-------------- + Postgres, US (1 row) SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; @@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; SET DateStyle TO 'US,SQL'; SHOW DateStyle; - DateStyle ---------------------------------------- - SQL with US (NonEuropean) conventions + DateStyle +----------- + SQL, US (1 row) SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; @@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; SET DateStyle TO 'European,Postgres'; SHOW DateStyle; - DateStyle ------------------------------------- - Postgres with European conventions + DateStyle +-------------------- + Postgres, European (1 row) INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957'); @@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; SET DateStyle TO 'European,ISO'; SHOW DateStyle; - DateStyle -------------------------------- - ISO with European conventions + DateStyle +--------------- + ISO, European (1 row) SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; @@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; SET DateStyle TO 'European,SQL'; SHOW DateStyle; - DateStyle -------------------------------- - SQL with European conventions + DateStyle +--------------- + SQL, European (1 row) SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; |