Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4df0f1d

Browse files
committed
Fix timestamptz_in so that parsing of 'now'::timestamptz gives right
answer when SET TIMEZONE has been done since the start of the currenttransaction. Per bug report from Robert Haas.I plan some futher cleanup in HEAD, but this is a low-risk patch forthe immediate issue in 7.3.
1 parent69c049c commit4df0f1d

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

‎src/backend/utils/adt/datetime.c

Lines changed: 3 additions & 5 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.100 2003/02/19 03:48:10 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.101 2003/02/20 05:24:55 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1253,9 +1253,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
12531253
caseDTK_NOW:
12541254
tmask= (DTK_DATE_M |DTK_TIME_M |DTK_M(TZ));
12551255
*dtype=DTK_DATE;
1256-
GetCurrentTimeUsec(tm,fsec);
1257-
if (tzp!=NULL)
1258-
*tzp=CTimeZone;
1256+
GetCurrentTimeUsec(tm,fsec,tzp);
12591257
break;
12601258

12611259
caseDTK_YESTERDAY:
@@ -1969,7 +1967,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
19691967
caseDTK_NOW:
19701968
tmask=DTK_TIME_M;
19711969
*dtype=DTK_TIME;
1972-
GetCurrentTimeUsec(tm,fsec);
1970+
GetCurrentTimeUsec(tm,fsec,NULL);
19731971
break;
19741972

19751973
caseDTK_ZULU:

‎src/backend/utils/adt/nabstime.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.102 2002/12/12 19:16:55 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.103 2003/02/20 05:24:55 tgl Exp $
1313
*
1414
* NOTES
1515
*
@@ -243,25 +243,24 @@ GetCurrentDateTime(struct tm * tm)
243243
inttz;
244244

245245
abstime2tm(GetCurrentTransactionStartTime(),&tz,tm,NULL);
246-
247-
return;
248246
}/* GetCurrentDateTime() */
249247

250248

251249
void
252-
GetCurrentTimeUsec(structtm*tm,fsec_t*fsec)
250+
GetCurrentTimeUsec(structtm*tm,fsec_t*fsec,int*tzp)
253251
{
254252
inttz;
255253
intusec;
256254

257255
abstime2tm(GetCurrentTransactionStartTimeUsec(&usec),&tz,tm,NULL);
256+
/* Note: don't pass NULL tzp directly to abstime2tm */
257+
if (tzp!=NULL)
258+
*tzp=tz;
258259
#ifdefHAVE_INT64_TIMESTAMP
259260
*fsec=usec;
260261
#else
261262
*fsec=usec*1.0e-6;
262263
#endif
263-
264-
return;
265264
}/* GetCurrentTimeUsec() */
266265

267266

‎src/include/utils/datetime.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
12-
* $Id: datetime.h,v 1.35 2003/02/19 03:48:10 momjian Exp $
12+
* $Id: datetime.h,v 1.36 2003/02/20 05:24:55 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -261,7 +261,7 @@ extern intday_tab[2][13];
261261

262262

263263
externvoidGetCurrentDateTime(structtm*tm);
264-
externvoidGetCurrentTimeUsec(structtm*tm,fsec_t*fsec);
264+
externvoidGetCurrentTimeUsec(structtm*tm,fsec_t*fsec,int*tzp);
265265
externvoidj2date(intjd,int*year,int*month,int*day);
266266
externintdate2j(intyear,intmonth,intday);
267267

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp