Skip to content

Commit cfa6999

Browse files
committed
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.
1 parent 274328c commit cfa6999

File tree

10 files changed

+65
-95
lines changed

10 files changed

+65
-95
lines changed

doc/src/sgml/func.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.158 2003/06/29 00:33:42 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.159 2003/07/15 19:19:55 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -6501,9 +6501,9 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
65016501
<programlisting>
65026502
SELECT current_setting('datestyle');
65036503

6504-
current_setting
6505-
---------------------------------------
6506-
ISO with US (NonEuropean) conventions
6504+
current_setting
6505+
-----------------
6506+
ISO, US
65076507
(1 row)
65086508
</programlisting>
65096509
</para>

doc/src/sgml/ref/set.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.77 2003/06/21 19:33:36 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.78 2003/07/15 19:19:56 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -154,7 +154,7 @@ SELECT setseed(<replaceable>value</replaceable>);
154154
for <literal>SET timezone TO <replaceable>value</></>. The
155155
syntax <literal>SET TIME ZONE</literal> allows special syntax
156156
for the time zone specification. Here are examples of valid
157-
values:
157+
values (but note some are accepted only on some platforms):
158158

159159
<variablelist>
160160
<varlistentry>

doc/src/sgml/ref/show.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.28 2003/06/27 19:08:37 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.29 2003/07/15 19:19:56 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -156,9 +156,9 @@ SHOW ALL
156156

157157
<programlisting>
158158
SHOW DateStyle;
159-
DateStyle
160-
---------------------------------------
161-
ISO with US (NonEuropean) conventions
159+
DateStyle
160+
-----------
161+
ISO, US
162162
(1 row)
163163
</programlisting>
164164
</para>

doc/src/sgml/release.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.196 2003/06/30 18:31:41 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.197 2003/07/15 19:19:55 tgl Exp $
33
-->
44

55
<appendix id="release">
@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
2424
worries about funny characters.
2525
-->
2626
<literallayout><![CDATA[
27+
Output of SHOW DATESTYLE is now in the same format accepted by SET DATESTYLE
2728
PL/Python is now an untrusted language, and is renamed to 'plpythonu'
2829
Dollar sign ($) is no longer allowed in operator names
2930
Dollar sign ($) can be a non-first character in identifiers

src/backend/commands/variable.c

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.79 2003/06/27 19:08:37 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.80 2003/07/15 19:19:56 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -90,7 +90,7 @@ assign_datestyle(const char *value, bool doit, bool interactive)
9090
newDateStyle = USE_SQL_DATES;
9191
dcnt++;
9292
}
93-
else if (strncasecmp(tok, "POSTGRESQL", 8) == 0)
93+
else if (strncasecmp(tok, "POSTGRES", 8) == 0)
9494
{
9595
newDateStyle = USE_POSTGRES_DATES;
9696
dcnt++;
@@ -190,13 +190,13 @@ assign_datestyle(const char *value, bool doit, bool interactive)
190190
strcpy(result, "SQL");
191191
break;
192192
case USE_GERMAN_DATES:
193-
strcpy(result, "GERMAN");
193+
strcpy(result, "German");
194194
break;
195195
default:
196-
strcpy(result, "POSTGRESQL");
196+
strcpy(result, "Postgres");
197197
break;
198198
}
199-
strcat(result, newEuroDates ? ", EURO" : ", US");
199+
strcat(result, newEuroDates ? ", European" : ", US");
200200

201201
/*
202202
* Finally, it's safe to assign to the global variables; the
@@ -208,36 +208,6 @@ assign_datestyle(const char *value, bool doit, bool interactive)
208208
return result;
209209
}
210210

211-
/*
212-
* show_datestyle: GUC show_hook for datestyle
213-
*/
214-
const char *
215-
show_datestyle(void)
216-
{
217-
static char buf[64];
218-
219-
switch (DateStyle)
220-
{
221-
case USE_ISO_DATES:
222-
strcpy(buf, "ISO");
223-
break;
224-
case USE_SQL_DATES:
225-
strcpy(buf, "SQL");
226-
break;
227-
case USE_GERMAN_DATES:
228-
strcpy(buf, "German");
229-
break;
230-
default:
231-
strcpy(buf, "Postgres");
232-
break;
233-
};
234-
strcat(buf, " with ");
235-
strcat(buf, ((EuroDates) ? "European" : "US (NonEuropean)"));
236-
strcat(buf, " conventions");
237-
238-
return buf;
239-
}
240-
241211

242212
/*
243213
* TIMEZONE

src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.136 2003/07/09 08:51:19 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.137 2003/07/15 19:19:56 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -1265,7 +1265,7 @@ static struct config_string ConfigureNamesString[] =
12651265
GUC_LIST_INPUT | GUC_REPORT
12661266
},
12671267
&datestyle_string,
1268-
"ISO, US", assign_datestyle, show_datestyle
1268+
"ISO, US", assign_datestyle, NULL
12691269
},
12701270

12711271
{

src/include/commands/variable.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
* variable.h
33
* Routines for handling specialized SET variables.
44
*
5-
* $Id: variable.h,v 1.20 2003/04/25 19:45:09 tgl Exp $
5+
* $Id: variable.h,v 1.21 2003/07/15 19:19:56 tgl Exp $
66
*
77
*/
88
#ifndef VARIABLE_H
99
#define VARIABLE_H
1010

1111
extern const char *assign_datestyle(const char *value,
1212
bool doit, bool interactive);
13-
extern const char *show_datestyle(void);
1413
extern const char *assign_timezone(const char *value,
1514
bool doit, bool interactive);
1615
extern const char *show_timezone(void);

src/test/regress/expected/horology-no-DST-before-1970.out

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP;
23852385
--
23862386
SET DateStyle TO 'US,Postgres';
23872387
SHOW DateStyle;
2388-
DateStyle
2389-
--------------------------------------------
2390-
Postgres with US (NonEuropean) conventions
2388+
DateStyle
2389+
--------------
2390+
Postgres, US
23912391
(1 row)
23922392

23932393
SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
25552555

25562556
SET DateStyle TO 'US,SQL';
25572557
SHOW DateStyle;
2558-
DateStyle
2559-
---------------------------------------
2560-
SQL with US (NonEuropean) conventions
2558+
DateStyle
2559+
-----------
2560+
SQL, US
25612561
(1 row)
25622562

25632563
SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
26432643

26442644
SET DateStyle TO 'European,Postgres';
26452645
SHOW DateStyle;
2646-
DateStyle
2647-
------------------------------------
2648-
Postgres with European conventions
2646+
DateStyle
2647+
--------------------
2648+
Postgres, European
26492649
(1 row)
26502650

26512651
INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957');
@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
27392739

27402740
SET DateStyle TO 'European,ISO';
27412741
SHOW DateStyle;
2742-
DateStyle
2743-
-------------------------------
2744-
ISO with European conventions
2742+
DateStyle
2743+
---------------
2744+
ISO, European
27452745
(1 row)
27462746

27472747
SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
28282828

28292829
SET DateStyle TO 'European,SQL';
28302830
SHOW DateStyle;
2831-
DateStyle
2832-
-------------------------------
2833-
SQL with European conventions
2831+
DateStyle
2832+
---------------
2833+
SQL, European
28342834
(1 row)
28352835

28362836
SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;

src/test/regress/expected/horology-solaris-1947.out

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP;
23852385
--
23862386
SET DateStyle TO 'US,Postgres';
23872387
SHOW DateStyle;
2388-
DateStyle
2389-
--------------------------------------------
2390-
Postgres with US (NonEuropean) conventions
2388+
DateStyle
2389+
--------------
2390+
Postgres, US
23912391
(1 row)
23922392

23932393
SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
25552555

25562556
SET DateStyle TO 'US,SQL';
25572557
SHOW DateStyle;
2558-
DateStyle
2559-
---------------------------------------
2560-
SQL with US (NonEuropean) conventions
2558+
DateStyle
2559+
-----------
2560+
SQL, US
25612561
(1 row)
25622562

25632563
SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
26432643

26442644
SET DateStyle TO 'European,Postgres';
26452645
SHOW DateStyle;
2646-
DateStyle
2647-
------------------------------------
2648-
Postgres with European conventions
2646+
DateStyle
2647+
--------------------
2648+
Postgres, European
26492649
(1 row)
26502650

26512651
INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957');
@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
27392739

27402740
SET DateStyle TO 'European,ISO';
27412741
SHOW DateStyle;
2742-
DateStyle
2743-
-------------------------------
2744-
ISO with European conventions
2742+
DateStyle
2743+
---------------
2744+
ISO, European
27452745
(1 row)
27462746

27472747
SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
28282828

28292829
SET DateStyle TO 'European,SQL';
28302830
SHOW DateStyle;
2831-
DateStyle
2832-
-------------------------------
2833-
SQL with European conventions
2831+
DateStyle
2832+
---------------
2833+
SQL, European
28342834
(1 row)
28352835

28362836
SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;

src/test/regress/expected/horology.out

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,9 +2385,9 @@ DROP TABLE TEMP_TIMESTAMP;
23852385
--
23862386
SET DateStyle TO 'US,Postgres';
23872387
SHOW DateStyle;
2388-
DateStyle
2389-
--------------------------------------------
2390-
Postgres with US (NonEuropean) conventions
2388+
DateStyle
2389+
--------------
2390+
Postgres, US
23912391
(1 row)
23922392

23932393
SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
@@ -2555,9 +2555,9 @@ SELECT '' AS seven, f1 AS us_iso FROM ABSTIME_TBL;
25552555

25562556
SET DateStyle TO 'US,SQL';
25572557
SHOW DateStyle;
2558-
DateStyle
2559-
---------------------------------------
2560-
SQL with US (NonEuropean) conventions
2558+
DateStyle
2559+
-----------
2560+
SQL, US
25612561
(1 row)
25622562

25632563
SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
@@ -2643,9 +2643,9 @@ SELECT '' AS seven, f1 AS us_sql FROM ABSTIME_TBL;
26432643

26442644
SET DateStyle TO 'European,Postgres';
26452645
SHOW DateStyle;
2646-
DateStyle
2647-
------------------------------------
2648-
Postgres with European conventions
2646+
DateStyle
2647+
--------------------
2648+
Postgres, European
26492649
(1 row)
26502650

26512651
INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957');
@@ -2739,9 +2739,9 @@ SELECT '' AS seven, f1 AS european_postgres FROM ABSTIME_TBL;
27392739

27402740
SET DateStyle TO 'European,ISO';
27412741
SHOW DateStyle;
2742-
DateStyle
2743-
-------------------------------
2744-
ISO with European conventions
2742+
DateStyle
2743+
---------------
2744+
ISO, European
27452745
(1 row)
27462746

27472747
SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
@@ -2828,9 +2828,9 @@ SELECT '' AS seven, f1 AS european_iso FROM ABSTIME_TBL;
28282828

28292829
SET DateStyle TO 'European,SQL';
28302830
SHOW DateStyle;
2831-
DateStyle
2832-
-------------------------------
2833-
SQL with European conventions
2831+
DateStyle
2832+
---------------
2833+
SQL, European
28342834
(1 row)
28352835

28362836
SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;

0 commit comments

Comments
 (0)