summaryrefslogtreecommitdiff
path: root/src/include/utils/nabstime.h
diff options
context:
space:
mode:
authorBruce Momjian1999-03-14 16:44:02 +0000
committerBruce Momjian1999-03-14 16:44:02 +0000
commitc10e6bcbed4b5a9ffea40300cff279cb854c1ba3 (patch)
treef5527fddd4e64b72553e2b789f403d2a0f30ad0c /src/include/utils/nabstime.h
parente2c4d41f32107b88f92a71d2c53e2ad850d93161 (diff)
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/include/utils/nabstime.h')
-rw-r--r--src/include/utils/nabstime.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/include/utils/nabstime.h b/src/include/utils/nabstime.h
index 58a262d3aab..fca6b628770 100644
--- a/src/include/utils/nabstime.h
+++ b/src/include/utils/nabstime.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nabstime.h,v 1.18 1999/02/13 23:22:25 momjian Exp $
+ * $Id: nabstime.h,v 1.19 1999/03/14 16:44:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,8 +23,13 @@
*
* ----------------------------------------------------------------
*/
-typedef int32 AbsoluteTime;
-typedef int32 RelativeTime;
+/* The original typedefs are bogus - they assume that the system's 'time_t'
+ * type is of size 32-bits. Under AlphaLinux, time_t is a long int, which
+ * is 64-bits. Therefore, typedef these both as simply 'time_t', and let
+ * the OS define what the size really is. -- RME 3/5/99
+ */
+typedef time_t AbsoluteTime;
+typedef time_t RelativeTime;
typedef struct
{