Skip to content

Commit 371f49b

Browse files
committed
Remove gratuitous discrepancy between extract() and date_part(),
regarding timezone_hour, timezone_minute vs. tz_hour, tz_minute. Document the former.
1 parent ec5c628 commit 371f49b

File tree

4 files changed

+37
-21
lines changed

4 files changed

+37
-21
lines changed

doc/src/sgml/func.sgml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.76 2001/10/09 18:46:00 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.77 2001/10/10 00:02:42 petere Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -2800,6 +2800,34 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5');
28002800
</informalexample>
28012801
</listitem>
28022802
</varlistentry>
2803+
<!--
2804+
<varlistentry>
2805+
<term><literal>timezone</literal></term>
2806+
<listitem>
2807+
<para>
2808+
The time zone offset. XXX But in what units?
2809+
</para>
2810+
</listitem>
2811+
</varlistentry>
2812+
-->
2813+
2814+
<varlistentry>
2815+
<term><literal>timezone_hour</literal></term>
2816+
<listitem>
2817+
<para>
2818+
The hour component of the time zone offset.
2819+
</para>
2820+
</listitem>
2821+
</varlistentry>
2822+
2823+
<varlistentry>
2824+
<term><literal>timezone_minute</literal></term>
2825+
<listitem>
2826+
<para>
2827+
The minute component of the time zone offset.
2828+
</para>
2829+
</listitem>
2830+
</varlistentry>
28032831

28042832
<varlistentry>
28052833
<term><literal>week</literal></term>
@@ -2838,12 +2866,6 @@ SELECT EXTRACT(YEAR FROM TIMESTAMP '2001-02-16 20:38:40');
28382866
</listitem>
28392867
</varlistentry>
28402868

2841-
<!--
2842-
tz
2843-
tz_hour
2844-
tz_minute
2845-
-->
2846-
28472869
</variablelist>
28482870

28492871
</para>

src/backend/parser/gram.y

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.261 2001/10/09 22:32:32 petere Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.262 2001/10/10 00:02:42 petere Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -315,8 +315,8 @@ static void doNegateFloat(Value *v);
315315
PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC,
316316
READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK,
317317
SCHEMA, SCROLL, SECOND_P, SELECT, SESSION, SESSION_USER, SET, SOME, SUBSTRING,
318-
TABLE, TEMPORARY, THEN, TIME, TIMESTAMP, TIMEZONE_HOUR,
319-
TIMEZONE_MINUTE, TO, TRAILING, TRANSACTION, TRIM, TRUE_P,
318+
TABLE, TEMPORARY, THEN, TIME, TIMESTAMP,
319+
TO, TRAILING, TRANSACTION, TRIM, TRUE_P,
320320
UNENCRYPTED, UNION, UNIQUE, UNKNOWN, UPDATE, USER, USING,
321321
VALUES, VARCHAR, VARYING, VIEW,
322322
WHEN, WHERE, WITH, WORK, YEAR_P, ZONE
@@ -5200,8 +5200,6 @@ extract_list: extract_arg FROM a_expr
52005200
extract_arg: datetime { $$ = $1; }
52015201
| SCONST { $$ = $1; }
52025202
| IDENT { $$ = $1; }
5203-
| TIMEZONE_HOUR { $$ = "tz_hour"; }
5204-
| TIMEZONE_MINUTE { $$ = "tz_minute"; }
52055203
;
52065204

52075205
/* position_list uses b_expr not a_expr to avoid conflict with general IN */
@@ -5738,8 +5736,6 @@ TokenId: ABSOLUTE { $$ = "absolute"; }
57385736
| TEMP { $$ = "temp"; }
57395737
| TEMPLATE { $$ = "template"; }
57405738
| TEMPORARY { $$ = "temporary"; }
5741-
| TIMEZONE_HOUR { $$ = "timezone_hour"; }
5742-
| TIMEZONE_MINUTE { $$ = "timezone_minute"; }
57435739
| TOAST { $$ = "toast"; }
57445740
| TRIGGER { $$ = "trigger"; }
57455741
| TRUNCATE { $$ = "truncate"; }

src/backend/parser/keywords.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.98 2001/10/02 21:39:35 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.99 2001/10/10 00:02:42 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -252,8 +252,6 @@ static ScanKeyword ScanKeywords[] = {
252252
{"then", THEN},
253253
{"time", TIME},
254254
{"timestamp", TIMESTAMP},
255-
{"timezone_hour", TIMEZONE_HOUR},
256-
{"timezone_minute", TIMEZONE_MINUTE},
257255
{"to", TO},
258256
{"toast", TOAST},
259257
{"trailing", TRAILING},

src/backend/utils/adt/datetime.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.70 2001/10/05 06:38:59 thomas Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.71 2001/10/10 00:02:42 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -293,9 +293,9 @@ static datetkn deltatktbl[] = {
293293
{"seconds", UNITS, DTK_SECOND},
294294
{"secs", UNITS, DTK_SECOND},
295295
{DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */
296-
{"tz", UNITS, DTK_TZ}, /* "timezone" time offset */
297-
{"tz_hour", UNITS, DTK_TZ_HOUR}, /* timezone hour units */
298-
{"tz_minute", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */
296+
{"timezone", UNITS, DTK_TZ}, /* "timezone" time offset */
297+
{"timezone_hour", UNITS, DTK_TZ_HOUR}, /* timezone hour units */
298+
{"timezone_minute", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */
299299
{"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */
300300
{"us", UNITS, DTK_MICROSEC},/* "microsecond" relative time units */
301301
{"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative time

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy