diff options
author | Bruce Momjian <bruce@momjian.us> | 1999-03-14 16:44:02 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1999-03-14 16:44:02 +0000 |
commit | c10e6bcbed4b5a9ffea40300cff279cb854c1ba3 (patch) | |
tree | f5527fddd4e64b72553e2b789f403d2a0f30ad0c /src/backend/utils/adt | |
parent | e2c4d41f32107b88f92a71d2c53e2ad850d93161 (diff) | |
download | postgresql-c10e6bcbed4b5a9ffea40300cff279cb854c1ba3.tar.gz postgresql-c10e6bcbed4b5a9ffea40300cff279cb854c1ba3.zip |
Attempting to insert a value of 'now' into a datetime type
results in a bogus datetime value under AlphaLinux. (Note that
the 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 synonymously
with the 'time_t' type, which on AlphaLinux is typedef'd as a 'long
int', which is 64-bits (not 32). The solution included here fixes
the datetime type (it now passes the regression test), but does not
pass the absolute and relative time regression tests. Presumably, a
more thorough investigation of how these types are used is warranted.
The included patch is from the v6.3.2 source, but can be applied to
the v6.4.2 source. Please note that there is also a RedHat-specific
patch distributed with the PostgreSQL source package from RedHat
that was applied first.
Rich Edwards
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r-- | src/backend/utils/adt/date.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index afad0ecbf7a..e582ebc2c65 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.30 1999/02/21 03:49:27 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.31 1999/03/14 16:44:01 momjian Exp $ * * NOTES * This code is actually (almost) unused. @@ -94,7 +94,7 @@ static int sec_tab[] = { * Function prototypes -- internal to this file only */ -static void reltime2tm(int32 time, struct tm * tm); +static void reltime2tm(RelativeTime time, struct tm * tm); #ifdef NOT_USED static int correct_unit(char *unit, int *unptr); @@ -161,7 +161,7 @@ reltimein(char *str) * reltimeout - converts the internal format to a reltime string */ char * -reltimeout(int32 time) +reltimeout(RelativeTime time) { char *result; struct tm tt, @@ -193,7 +193,7 @@ do { \ } while(0) static void -reltime2tm(int32 time, struct tm * tm) +reltime2tm(RelativeTime time, struct tm * tm) { TMODULO(time, tm->tm_year, 31536000); TMODULO(time, tm->tm_mon, 2592000); |