Commit cfa6999d authored by Tom Lane's avatar Tom Lane

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.
parent 274328c8
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.158 2003/06/29 00:33:42 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.159 2003/07/15 19:19:55 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -6501,9 +6501,9 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, .. ...@@ -6501,9 +6501,9 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<programlisting> <programlisting>
SELECT current_setting('datestyle'); SELECT current_setting('datestyle');
current_setting current_setting
--------------------------------------- -----------------
ISO with US (NonEuropean) conventions ISO, US
(1 row) (1 row)
</programlisting> </programlisting>
</para> </para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.77 2003/06/21 19:33:36 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.78 2003/07/15 19:19:56 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -154,7 +154,7 @@ SELECT setseed(<replaceable>value</replaceable>); ...@@ -154,7 +154,7 @@ SELECT setseed(<replaceable>value</replaceable>);
for <literal>SET timezone TO <replaceable>value</></>. The for <literal>SET timezone TO <replaceable>value</></>. The
syntax <literal>SET TIME ZONE</literal> allows special syntax syntax <literal>SET TIME ZONE</literal> allows special syntax
for the time zone specification. Here are examples of valid for the time zone specification. Here are examples of valid
values: values (but note some are accepted only on some platforms):
<variablelist> <variablelist>
<varlistentry> <varlistentry>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.28 2003/06/27 19:08:37 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.29 2003/07/15 19:19:56 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -156,9 +156,9 @@ SHOW ALL ...@@ -156,9 +156,9 @@ SHOW ALL
<programlisting> <programlisting>
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
--------------------------------------- -----------
ISO with US (NonEuropean) conventions ISO, US
(1 row) (1 row)
</programlisting> </programlisting>
</para> </para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.196 2003/06/30 18:31:41 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.197 2003/07/15 19:19:55 tgl Exp $
--> -->
<appendix id="release"> <appendix id="release">
...@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without ...@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
worries about funny characters. worries about funny characters.
--> -->
<literallayout><![CDATA[ <literallayout><![CDATA[
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' PL/Python is now an untrusted language, and is renamed to 'plpythonu'
Dollar sign ($) is no longer allowed in operator names Dollar sign ($) is no longer allowed in operator names
Dollar sign ($) can be a non-first character in identifiers Dollar sign ($) can be a non-first character in identifiers
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -90,7 +90,7 @@ assign_datestyle(const char *value, bool doit, bool interactive)
newDateStyle = USE_SQL_DATES; newDateStyle = USE_SQL_DATES;
dcnt++; dcnt++;
} }
else if (strncasecmp(tok, "POSTGRESQL", 8) == 0) else if (strncasecmp(tok, "POSTGRES", 8) == 0)
{ {
newDateStyle = USE_POSTGRES_DATES; newDateStyle = USE_POSTGRES_DATES;
dcnt++; dcnt++;
...@@ -190,13 +190,13 @@ assign_datestyle(const char *value, bool doit, bool interactive) ...@@ -190,13 +190,13 @@ assign_datestyle(const char *value, bool doit, bool interactive)
strcpy(result, "SQL"); strcpy(result, "SQL");
break; break;
case USE_GERMAN_DATES: case USE_GERMAN_DATES:
strcpy(result, "GERMAN"); strcpy(result, "German");
break; break;
default: default:
strcpy(result, "POSTGRESQL"); strcpy(result, "Postgres");
break; break;
} }
strcat(result, newEuroDates ? ", EURO" : ", US"); strcat(result, newEuroDates ? ", European" : ", US");
/* /*
* Finally, it's safe to assign to the global variables; the * Finally, it's safe to assign to the global variables; the
...@@ -208,36 +208,6 @@ assign_datestyle(const char *value, bool doit, bool interactive) ...@@ -208,36 +208,6 @@ assign_datestyle(const char *value, bool doit, bool interactive)
return result; 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 * TIMEZONE
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * 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[] = ...@@ -1265,7 +1265,7 @@ static struct config_string ConfigureNamesString[] =
GUC_LIST_INPUT | GUC_REPORT GUC_LIST_INPUT | GUC_REPORT
}, },
&datestyle_string, &datestyle_string,
"ISO, US", assign_datestyle, show_datestyle "ISO, US", assign_datestyle, NULL
}, },
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variable.h * variable.h
* Routines for handling specialized SET variables. * 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 #ifndef VARIABLE_H
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
extern const char *assign_datestyle(const char *value, extern const char *assign_datestyle(const char *value,
bool doit, bool interactive); bool doit, bool interactive);
extern const char *show_datestyle(void);
extern const char *assign_timezone(const char *value, extern const char *assign_timezone(const char *value,
bool doit, bool interactive); bool doit, bool interactive);
extern const char *show_timezone(void); extern const char *show_timezone(void);
......
...@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP; ...@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP;
-- --
SET DateStyle TO 'US,Postgres'; SET DateStyle TO 'US,Postgres';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
-------------------------------------------- --------------
Postgres with US (NonEuropean) conventions Postgres, US
(1 row) (1 row)
SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
...@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; ...@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
SET DateStyle TO 'US,SQL'; SET DateStyle TO 'US,SQL';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
--------------------------------------- -----------
SQL with US (NonEuropean) conventions SQL, US
(1 row) (1 row)
SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
...@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; ...@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
SET DateStyle TO 'European,Postgres'; SET DateStyle TO 'European,Postgres';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------------ --------------------
Postgres with European conventions Postgres, European
(1 row) (1 row)
INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957'); INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957');
...@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; ...@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
SET DateStyle TO 'European,ISO'; SET DateStyle TO 'European,ISO';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------- ---------------
ISO with European conventions ISO, European
(1 row) (1 row)
SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
...@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; ...@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
SET DateStyle TO 'European,SQL'; SET DateStyle TO 'European,SQL';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------- ---------------
SQL with European conventions SQL, European
(1 row) (1 row)
SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;
......
...@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP; ...@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP;
-- --
SET DateStyle TO 'US,Postgres'; SET DateStyle TO 'US,Postgres';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
-------------------------------------------- --------------
Postgres with US (NonEuropean) conventions Postgres, US
(1 row) (1 row)
SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
...@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; ...@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
SET DateStyle TO 'US,SQL'; SET DateStyle TO 'US,SQL';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
--------------------------------------- -----------
SQL with US (NonEuropean) conventions SQL, US
(1 row) (1 row)
SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
...@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; ...@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
SET DateStyle TO 'European,Postgres'; SET DateStyle TO 'European,Postgres';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------------ --------------------
Postgres with European conventions Postgres, European
(1 row) (1 row)
INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957'); INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957');
...@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; ...@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
SET DateStyle TO 'European,ISO'; SET DateStyle TO 'European,ISO';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------- ---------------
ISO with European conventions ISO, European
(1 row) (1 row)
SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
...@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; ...@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
SET DateStyle TO 'European,SQL'; SET DateStyle TO 'European,SQL';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------- ---------------
SQL with European conventions SQL, European
(1 row) (1 row)
SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;
......
...@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP; ...@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP;
-- --
SET DateStyle TO 'US,Postgres'; SET DateStyle TO 'US,Postgres';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
-------------------------------------------- --------------
Postgres with US (NonEuropean) conventions Postgres, US
(1 row) (1 row)
SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
...@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL; ...@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
SET DateStyle TO 'US,SQL'; SET DateStyle TO 'US,SQL';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
--------------------------------------- -----------
SQL with US (NonEuropean) conventions SQL, US
(1 row) (1 row)
SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
...@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL; ...@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
SET DateStyle TO 'European,Postgres'; SET DateStyle TO 'European,Postgres';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------------ --------------------
Postgres with European conventions Postgres, European
(1 row) (1 row)
INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957'); INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957');
...@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL; ...@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
SET DateStyle TO 'European,ISO'; SET DateStyle TO 'European,ISO';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------- ---------------
ISO with European conventions ISO, European
(1 row) (1 row)
SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
...@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL; ...@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
SET DateStyle TO 'European,SQL'; SET DateStyle TO 'European,SQL';
SHOW DateStyle; SHOW DateStyle;
DateStyle DateStyle
------------------------------- ---------------
SQL with European conventions SQL, European
(1 row) (1 row)
SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment