Cause SHOW DATESTYLE to produce a string that will be accepted by SET
authorTom Lane
Tue, 15 Jul 2003 19:19:56 +0000 (19:19 +0000)
committerTom Lane
Tue, 15 Jul 2003 19:19:56 +0000 (19:19 +0000)
DATESTYLE, for instance 'SQL, European' instead of
'SQL with European conventions'.  Per gripe a month or two back from
Barry Lind.

doc/src/sgml/func.sgml
doc/src/sgml/ref/set.sgml
doc/src/sgml/ref/show.sgml
doc/src/sgml/release.sgml
src/backend/commands/variable.c
src/backend/utils/misc/guc.c
src/include/commands/variable.h
src/test/regress/expected/horology-no-DST-before-1970.out
src/test/regress/expected/horology-solaris-1947.out
src/test/regress/expected/horology.out

index e15a44570b1acdbe252b906e647096c8db1bc81e..a59b59211b2e8ba6118c182d344c75b3c4892d37 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -6501,9 +6501,9 @@ SET search_path TO schema schema, ..
 
 SELECT current_setting('datestyle');
 
           current_setting
----------------------------------------
- ISO with US (NonEuropean) conventions
+ current_setting
+-----------------
+ ISO, US
 (1 row)
 
    
index a394820b7f1e26eb1be7c1293fdcb656b97b87df..7a5c8b51fb7ee91e5a95999398b9c520b81ad078 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -154,7 +154,7 @@ SELECT setseed(value);
        for SET timezone TO value.  The
        syntax SET TIME ZONE allows special syntax
        for the time zone specification.  Here are examples of valid
-       values:
+       values (but note some are accepted only on some platforms):
 
        
         
index 09619bb4827a772f4dcab0ed894dc1754946e3b2..1302ee2661ac887263801046cd9e84d6bdf8c6a2 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -156,9 +156,9 @@ SHOW ALL
 
 
 SHOW DateStyle;
              DateStyle
----------------------------------------
- ISO with US (NonEuropean) conventions
+ DateStyle
+-----------
+ ISO, US
 (1 row)
 
   
index a17669e73ea62beceaa6bb662e818c5d5ce6cd56..5164f7155a126c81a62bbbeda56111f43cf9e014 100644 (file)
@@ -1,5 +1,5 @@
 
 
 
@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
 worries about funny characters.
 -->
 
+Output of SHOW DATESTYLE is now in the same format accepted by SET DATESTYLE
 PL/Python is now an untrusted language, and is renamed to 'plpythonu'
 Dollar sign ($) is no longer allowed in operator names
 Dollar sign ($) can be a non-first character in identifiers
index 3dd4724f7741dc687700d6806078490c07b828fc..cc32ada4a4509ed74bc578dea32bd59379b39df0 100644 (file)
@@ -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
index 2769abd87e4306318a654cbc2866b98e12a417e0..8138c46918d6d6f435a2f2663ffa56028fb9f725 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut .
  *
  * 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
    },
 
    {
index 68a0ebf7450e15a568fbf659e076ca42547e6d4a..fda1d9f0e56362476a5cf4509c4010da87686311 100644 (file)
@@ -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);
index a5edd6103f1537d59665497bc483fa7b35e86d6b..1ad38e348611f3634de720e7bf92a9785b4ac02f 100644 (file)
@@ -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;
index ea64e96beed10cfa1d4e073b9b17e7da0a5e940b..31619de8fd91c8c23d345ebdab175e783b8f6a52 100644 (file)
@@ -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;
index 084f9fe2a64104319afb5f1124700398d1476383..174dc9cdc0db5d2e2bf7a68110d1ac794732bdfd 100644 (file)
@@ -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;