1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

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
This commit is contained in:
Bruce Momjian
1999-03-14 16:44:02 +00:00
parent e2c4d41f32
commit c10e6bcbed
3 changed files with 15 additions and 10 deletions

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.75 1999/03/14 05:09:05 momjian Exp $
* $Id: builtins.h,v 1.76 1999/03/14 16:44:01 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
@ -195,8 +195,8 @@ extern int32 pqtest(struct varlena * vlena);
/* arrayfuncs.c */
/* date.c */
extern int32 reltimein(char *timestring);
extern char *reltimeout(int32 timevalue);
extern RelativeTime reltimein(char *timestring);
extern char *reltimeout(RelativeTime timevalue);
extern TimeInterval tintervalin(char *intervalstr);
extern char *tintervalout(TimeInterval interval);
extern RelativeTime timespan_reltime(TimeSpan *timespan);