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

Commitc10e6bc

Browse files
committed
Attempting to insert a value of 'now' into a datetime type
results in a bogus datetime value under AlphaLinux. (Note thatthe link to submit a port-specific bug on your website is broken)-Test Case:----------testdb=> create table dttest (dt datetime);testdb=> insert into dttest values ('now');--------------------------------------------------------------------------Solution:---------The basic problem is the typedefs of AbsoluteTime and RelativeTime,which are both 'int32'. These types appear to be used synonymouslywith the 'time_t' type, which on AlphaLinux is typedef'd as a 'longint', which is 64-bits (not 32). The solution included here fixesthe datetime type (it now passes the regression test), but does notpass the absolute and relative time regression tests. Presumably, amore thorough investigation of how these types are used is warranted.The included patch is from the v6.3.2 source, but can be applied tothe v6.4.2 source. Please note that there is also a RedHat-specificpatch distributed with the PostgreSQL source package from RedHatthat was applied first.Rich Edwards
1 parente2c4d41 commitc10e6bc

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

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

Lines changed: 4 additions & 4 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/date.c,v 1.30 1999/02/21 03:49:27 scrappy Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.31 1999/03/14 16:44:01 momjian Exp $
1313
*
1414
* NOTES
1515
* This code is actually (almost) unused.
@@ -94,7 +94,7 @@ static intsec_tab[] = {
9494
* Function prototypes -- internal to this file only
9595
*/
9696

97-
staticvoidreltime2tm(int32time,structtm*tm);
97+
staticvoidreltime2tm(RelativeTimetime,structtm*tm);
9898

9999
#ifdefNOT_USED
100100
staticintcorrect_unit(char*unit,int*unptr);
@@ -161,7 +161,7 @@ reltimein(char *str)
161161
*reltimeout- converts the internal format to a reltime string
162162
*/
163163
char*
164-
reltimeout(int32time)
164+
reltimeout(RelativeTimetime)
165165
{
166166
char*result;
167167
structtmtt,
@@ -193,7 +193,7 @@ do { \
193193
} while(0)
194194

195195
staticvoid
196-
reltime2tm(int32time,structtm*tm)
196+
reltime2tm(RelativeTimetime,structtm*tm)
197197
{
198198
TMODULO(time,tm->tm_year,31536000);
199199
TMODULO(time,tm->tm_mon,2592000);

‎src/include/utils/builtins.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: builtins.h,v 1.75 1999/03/1405:09:05 momjian Exp $
9+
* $Id: builtins.h,v 1.76 1999/03/1416:44:01 momjian Exp $
1010
*
1111
* NOTES
1212
* This should normally only be included by fmgr.h.
@@ -195,8 +195,8 @@ extern int32 pqtest(struct varlena * vlena);
195195
/* arrayfuncs.c */
196196

197197
/* date.c */
198-
externint32reltimein(char*timestring);
199-
externchar*reltimeout(int32timevalue);
198+
externRelativeTimereltimein(char*timestring);
199+
externchar*reltimeout(RelativeTimetimevalue);
200200
externTimeIntervaltintervalin(char*intervalstr);
201201
externchar*tintervalout(TimeIntervalinterval);
202202
externRelativeTimetimespan_reltime(TimeSpan*timespan);

‎src/include/utils/nabstime.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: nabstime.h,v 1.18 1999/02/13 23:22:25 momjian Exp $
9+
* $Id: nabstime.h,v 1.19 1999/03/14 16:44:02 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -23,8 +23,13 @@
2323
*
2424
* ----------------------------------------------------------------
2525
*/
26-
typedefint32AbsoluteTime;
27-
typedefint32RelativeTime;
26+
/* The original typedefs are bogus - they assume that the system's 'time_t'
27+
* type is of size 32-bits. Under AlphaLinux, time_t is a long int, which
28+
* is 64-bits. Therefore, typedef these both as simply 'time_t', and let
29+
* the OS define what the size really is. -- RME 3/5/99
30+
*/
31+
typedeftime_tAbsoluteTime;
32+
typedeftime_tRelativeTime;
2833

2934
typedefstruct
3035
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp