$NetBSD: postgresql-7.0.3-alpha.diff,v 1.1 2001/02/13 02:39:32 jlam Exp $ This diff is derived by Berndt Josef Wulf from the patch located at: http://www.rkirkpat.net/software/postgresql-7.0-alpha.patch.gz to patch cleanly into the pkgsrc PostgreSQL source tree, and fixes several problems related to 64-bit integers. This patch will no longer be needed for the forthcoming PostgreSQL 7.1 release. --- backend/access/hash/hashfunc.c.orig Mon Feb 12 21:28:48 2001 +++ backend/access/hash/hashfunc.c Mon Feb 12 21:28:48 2001 @@ -22,15 +22,15 @@ #include "access/hash.h" uint32 -hashint2(int16 key) +hashint2(Datum key) { - return (uint32) ~key; + return (uint32) ~((int16)key); } uint32 -hashint4(uint32 key) +hashint4(Datum key) { - return ~key; + return ~((uint32)key); } uint32 @@ -172,12 +172,12 @@ #define PRIME2 1048583 uint32 -hashchar(char key) +hashchar(Datum key) { uint32 h; /* Convert char to integer */ - h = (key - ' '); + h = ((char)key - ' '); h %= PRIME2; return h; --- backend/access/nbtree/nbtcompare.c.orig Mon Feb 12 21:28:48 2001 +++ backend/access/nbtree/nbtcompare.c Mon Feb 12 21:28:48 2001 @@ -27,13 +27,13 @@ #include "utils/builtins.h" int32 -btint2cmp(int16 a, int16 b) +btint2cmp(Datum a, Datum b) { - return (int32) (a - b); + return (int32) ((int16)a - (int16)b); } int32 -btint4cmp(int32 a, int32 b) +btint4cmp(Datum a, Datum b) { if (a > b) return 1; @@ -55,15 +55,15 @@ } int32 -btint24cmp(int16 a, int32 b) +btint24cmp(Datum a, Datum b) { - return ((int32) a) - b; + return ((int16) a) - (int32)b; } int32 -btint42cmp(int32 a, int16 b) +btint42cmp(Datum a, Datum b) { - return a - ((int32) b); + return (int32)a - ((int16) b); } int32 @@ -118,8 +118,9 @@ int32 -btabstimecmp(AbsoluteTime a, AbsoluteTime b) +btabstimecmp(Datum da, Datum db) { + AbsoluteTime a = da, b = db; if (AbsoluteTimeIsBefore(a, b)) return -1; else if (AbsoluteTimeIsBefore(b, a)) @@ -129,7 +130,7 @@ } int32 -btcharcmp(char a, char b) +btcharcmp(Datum a, Datum b) { return (int32) ((uint8) a - (uint8) b); } --- backend/utils/adt/char.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/char.c Mon Feb 12 21:28:48 2001 @@ -35,7 +35,7 @@ * charout - converts 'x' to "x" */ char * -charout(int32 ch) +charout(Datum ch) { char *result = (char *) palloc(2); @@ -70,7 +70,7 @@ * printable character... */ char * -cidout(int32 c) +cidout(Datum c) { char *result; CommandId c2; @@ -87,69 +87,69 @@ *****************************************************************************/ bool -chareq(int8 arg1, int8 arg2) +chareq(Datum arg1, Datum arg2) { - return arg1 == arg2; + return (int8)arg1 == (int8)arg2; } bool -charne(int8 arg1, int8 arg2) +charne(Datum arg1, Datum arg2) { - return arg1 != arg2; + return (int8)arg1 != (int8)arg2; } bool -charlt(int8 arg1, int8 arg2) +charlt(Datum arg1, Datum arg2) { return (uint8) arg1 < (uint8) arg2; } bool -charle(int8 arg1, int8 arg2) +charle(Datum arg1, Datum arg2) { return (uint8) arg1 <= (uint8) arg2; } bool -chargt(int8 arg1, int8 arg2) +chargt(Datum arg1, Datum arg2) { return (uint8) arg1 > (uint8) arg2; } bool -charge(int8 arg1, int8 arg2) +charge(Datum arg1, Datum arg2) { return (uint8) arg1 >= (uint8) arg2; } int8 -charpl(int8 arg1, int8 arg2) +charpl(Datum arg1, Datum arg2) { - return arg1 + arg2; + return (int8)arg1 + (int8)arg2; } int8 -charmi(int8 arg1, int8 arg2) +charmi(Datum arg1, Datum arg2) { - return arg1 - arg2; + return (int8)arg1 - (int8)arg2; } int8 -charmul(int8 arg1, int8 arg2) +charmul(Datum arg1, Datum arg2) { - return arg1 * arg2; + return (int8)arg1 * (int8)arg2; } int8 -chardiv(int8 arg1, int8 arg2) +chardiv(Datum arg1, Datum arg2) { - return arg1 / arg2; + return (int8)arg1 / (int8)arg2; } bool -cideq(int8 arg1, int8 arg2) +cideq(Datum arg1, Datum arg2) { - return arg1 == arg2; + return (int8)arg1 == (int8)arg2; } int8 @@ -159,13 +159,13 @@ } text * -char_text(int8 arg1) +char_text(Datum arg1) { text *result; result = palloc(VARHDRSZ + 1); VARSIZE(result) = VARHDRSZ + 1; - *(VARDATA(result)) = arg1; + *(VARDATA(result)) = (int8)arg1; return result; } --- backend/utils/adt/float.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/float.c Mon Feb 12 21:28:48 2001 @@ -138,7 +138,7 @@ * until the distributions are updated. * --djm 12/16/96 */ -#if ( defined(linux) && defined(__alpha__) ) && !defined(UNSAFE_FLOATS) +#if ( defined(linux) && defined(__alpha__) ) && !defined(UNSAFE_FLOATS) && 0 #define UNSAFE_FLOATS #endif @@ -864,9 +864,10 @@ * i4tod - converts an int4 number to a float8 number */ float64 -i4tod(int32 num) +i4tod(Datum n) { float64 result; + int32 num = (int32) n; result = (float64) palloc(sizeof(float64data)); @@ -879,9 +880,10 @@ * i2tod - converts an int2 number to a float8 number */ float64 -i2tod(int16 num) +i2tod(Datum n) { float64 result; + int16 num = (int16) n; result = (float64) palloc(sizeof(float64data)); @@ -932,9 +934,10 @@ * i4tof - converts an int4 number to a float8 number */ float32 -i4tof(int32 num) +i4tof(Datum n) { float32 result; + int32 num = (int32) n; result = (float32) palloc(sizeof(float32data)); @@ -947,9 +950,10 @@ * i2tof - converts an int2 number to a float8 number */ float32 -i2tof(int16 num) +i2tof(Datum n) { float32 result; + int16 num = (int16) n; result = (float32) palloc(sizeof(float32data)); --- backend/utils/adt/int.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/int.c Mon Feb 12 21:28:48 2001 @@ -62,7 +62,7 @@ * int2out - converts short to "num" */ char * -int2out(int16 sh) +int2out(Datum sh) { char *result; @@ -227,12 +227,12 @@ * int4out - converts int4 to "num" */ char * -int4out(int32 l) +int4out(Datum l) { char *result; result = (char *) palloc(12); /* assumes sign, 10 digits, '\0' */ - ltoa(l, result); + ltoa((int32)l, result); return result; } @@ -244,14 +244,16 @@ */ int32 -i2toi4(int16 arg1) +i2toi4(Datum arg1) { return (int32) arg1; } int16 -i4toi2(int32 arg1) +i4toi2(Datum arg) { + int32 arg1 = (int32) arg; + if (arg1 < SHRT_MIN) elog(ERROR, "i4toi2: '%d' causes int2 underflow", arg1); if (arg1 > SHRT_MAX) @@ -261,7 +263,7 @@ } text * -int2_text(int16 arg1) +int2_text(Datum arg1) { text *result; @@ -305,7 +307,7 @@ } /* text_int2() */ text * -int4_text(int32 arg1) +int4_text(Datum arg1) { text *result; @@ -364,147 +366,147 @@ * intge - returns 1 iff arg1 >= arg2 */ bool -int4eq(int32 arg1, int32 arg2) +int4eq(Datum arg1, Datum arg2) { - return arg1 == arg2; + return (int32)arg1 == (int32)arg2; } bool -int4ne(int32 arg1, int32 arg2) +int4ne(Datum arg1, Datum arg2) { - return arg1 != arg2; + return (int32)arg1 != (int32)arg2; } bool -int4lt(int32 arg1, int32 arg2) +int4lt(Datum arg1, Datum arg2) { - return arg1 < arg2; + return (int32)arg1 < (int32)arg2; } bool -int4le(int32 arg1, int32 arg2) +int4le(Datum arg1, Datum arg2) { - return arg1 <= arg2; + return (int32)arg1 <= (int32)arg2; } bool -int4gt(int32 arg1, int32 arg2) +int4gt(Datum arg1, Datum arg2) { - return arg1 > arg2; + return (int32)arg1 > (int32)arg2; } bool -int4ge(int32 arg1, int32 arg2) +int4ge(Datum arg1, Datum arg2) { - return arg1 >= arg2; + return (int32)arg1 >= (int32)arg2; } bool -int2eq(int16 arg1, int16 arg2) +int2eq(Datum arg1, Datum arg2) { - return arg1 == arg2; + return (int16)arg1 == (int16)arg2; } bool -int2ne(int16 arg1, int16 arg2) +int2ne(Datum arg1, Datum arg2) { - return arg1 != arg2; + return (int16)arg1 != (int16)arg2; } bool -int2lt(int16 arg1, int16 arg2) +int2lt(Datum arg1, Datum arg2) { - return arg1 < arg2; + return (int16)arg1 < (int16)arg2; } bool -int2le(int16 arg1, int16 arg2) +int2le(Datum arg1, Datum arg2) { - return arg1 <= arg2; + return (int16)arg1 <= (int16)arg2; } bool -int2gt(int16 arg1, int16 arg2) +int2gt(Datum arg1, Datum arg2) { - return arg1 > arg2; + return (int16)arg1 > (int16)arg2; } bool -int2ge(int16 arg1, int16 arg2) +int2ge(Datum arg1, Datum arg2) { - return arg1 >= arg2; + return (int16)arg1 >= (int16)arg2; } bool -int24eq(int32 arg1, int32 arg2) +int24eq(Datum arg1, Datum arg2) { - return arg1 == arg2; + return (int32)arg1 == (int32)arg2; } bool -int24ne(int32 arg1, int32 arg2) +int24ne(Datum arg1, Datum arg2) { - return arg1 != arg2; + return (int32)arg1 != (int32)arg2; } bool -int24lt(int32 arg1, int32 arg2) +int24lt(Datum arg1, Datum arg2) { - return arg1 < arg2; + return (int32)arg1 < (int32)arg2; } bool -int24le(int32 arg1, int32 arg2) +int24le(Datum arg1, Datum arg2) { - return arg1 <= arg2; + return (int32)arg1 <= (int32)arg2; } bool -int24gt(int32 arg1, int32 arg2) +int24gt(Datum arg1, Datum arg2) { - return arg1 > arg2; + return (int32)arg1 > (int32)arg2; } bool -int24ge(int32 arg1, int32 arg2) +int24ge(Datum arg1, Datum arg2) { - return arg1 >= arg2; + return (int32)arg1 >= (int32)arg2; } bool -int42eq(int32 arg1, int32 arg2) +int42eq(Datum arg1, Datum arg2) { - return arg1 == arg2; + return (int32)arg1 == (int32)arg2; } bool -int42ne(int32 arg1, int32 arg2) +int42ne(Datum arg1, Datum arg2) { - return arg1 != arg2; + return (int32)arg1 != (int32)arg2; } bool -int42lt(int32 arg1, int32 arg2) +int42lt(Datum arg1, Datum arg2) { - return arg1 < arg2; + return (int32)arg1 < (int32)arg2; } bool -int42le(int32 arg1, int32 arg2) +int42le(Datum arg1, Datum arg2) { - return arg1 <= arg2; + return (int32)arg1 <= (int32)arg2; } bool -int42gt(int32 arg1, int32 arg2) +int42gt(Datum arg1, Datum arg2) { - return arg1 > arg2; + return (int32)arg1 > (int32)arg2; } bool -int42ge(int32 arg1, int32 arg2) +int42ge(Datum arg1, Datum arg2) { - return arg1 >= arg2; + return (int32)arg1 >= (int32)arg2; } /* @@ -514,159 +516,160 @@ * int[24]div - returns arg1 / arg2 */ int32 -int4um(int32 arg) +int4um(Datum arg) { - return -arg; + return (int32)-arg; } int32 -int4pl(int32 arg1, int32 arg2) +int4pl(Datum arg1, Datum arg2) { - return arg1 + arg2; + return (int32)arg1 + (int32)arg2; } int32 -int4mi(int32 arg1, int32 arg2) +int4mi(Datum arg1, Datum arg2) { - return arg1 - arg2; + return (int32)arg1 - (int32)arg2; } int32 -int4mul(int32 arg1, int32 arg2) +int4mul(Datum arg1, Datum arg2) { - return arg1 * arg2; + return (int32)arg1 * (int32)arg2; } int32 -int4div(int32 arg1, int32 arg2) +int4div(Datum arg1, Datum arg2) { - return arg1 / arg2; + return (int32)arg1 / (int32)arg2; } int32 -int4inc(int32 arg) +int4inc(Datum arg) { - return arg + (int32) 1; + return (int32)++arg; } int16 -int2um(int16 arg) +int2um(Datum arg) { - return -arg; + return (int16)-arg; } int16 -int2pl(int16 arg1, int16 arg2) +int2pl(Datum arg1, Datum arg2) { - return arg1 + arg2; + return (int16)arg1 + (int16)arg2; } int16 -int2mi(int16 arg1, int16 arg2) +int2mi(Datum arg1, Datum arg2) { - return arg1 - arg2; + return (int16)arg1 - (int16)arg2; } int16 -int2mul(int16 arg1, int16 arg2) +int2mul(Datum arg1, Datum arg2) { - return arg1 * arg2; + return (int16)arg1 * (int16)arg2; } int16 -int2div(int16 arg1, int16 arg2) +int2div(Datum arg1, Datum arg2) { - return arg1 / arg2; + return (int16)arg1 / (int16)arg2; } int16 -int2inc(int16 arg) +int2inc(Datum arg) { - return arg + (int16) 1; + return (int16)++arg; } int32 -int24pl(int32 arg1, int32 arg2) +int24pl(Datum arg1, Datum arg2) { - return arg1 + arg2; + return (int32)arg1 + (int32)arg2; } int32 -int24mi(int32 arg1, int32 arg2) +int24mi(Datum arg1, Datum arg2) { - return arg1 - arg2; + return (int32)arg1 - (int32)arg2; } int32 -int24mul(int32 arg1, int32 arg2) +int24mul(Datum arg1, Datum arg2) { - return arg1 * arg2; + return (int32)arg1 * (int32)arg2; } int32 -int24div(int32 arg1, int32 arg2) +int24div(Datum arg1, Datum arg2) { - return arg1 / arg2; + return (int32)arg1 / (int32)arg2; } int32 -int42pl(int32 arg1, int32 arg2) +int42pl(Datum arg1, Datum arg2) { - return arg1 + arg2; + return (int32)arg1 + (int32)arg2; } int32 -int42mi(int32 arg1, int32 arg2) +int42mi(Datum arg1, Datum arg2) { - return arg1 - arg2; + return (int32)arg1 - (int32)arg2; } int32 -int42mul(int32 arg1, int32 arg2) +int42mul(Datum arg1, Datum arg2) { - return arg1 * arg2; + return (int32)arg1 * (int32)arg2; } int32 -int42div(int32 arg1, int32 arg2) +int42div(Datum arg1, Datum arg2) { - return arg1 / arg2; + return (int32)arg1 / (int32)arg2; } /* * int[24]mod - returns arg1 mod arg2 */ int32 -int4mod(int32 arg1, int32 arg2) +int4mod(Datum arg1, Datum arg2) { - return arg1 % arg2; + return (int32)arg1 % (int32)arg2; } int32 -int2mod(int16 arg1, int16 arg2) +int2mod(Datum arg1, Datum arg2) { - return arg1 % arg2; + return (int16)arg1 % (int16)arg2; } int32 -int24mod(int32 arg1, int32 arg2) +int24mod(Datum arg1, Datum arg2) { - return arg1 % arg2; + return (int32)arg1 % (int32)arg2; } int32 -int42mod(int32 arg1, int32 arg2) +int42mod(Datum arg1, Datum arg2) { - return arg1 % arg2; + return (int32)arg1 % (int32)arg2; } /* int[24]fac() * Factorial */ int32 -int4fac(int32 arg1) +int4fac(Datum arg) { int32 result; + int32 arg1 = (int32) arg; if (arg1 < 1) result = 0; @@ -677,9 +680,10 @@ } int32 -int2fac(int16 arg1) +int2fac(Datum arg) { int32 result; + int16 arg1 = (int16) arg; if (arg1 < 1) result = 0; @@ -693,37 +697,37 @@ * Absolute value */ int32 -int4abs(int32 arg1) +int4abs(Datum arg1) { - return ((arg1 < 0) ? -arg1 : arg1); + return ((arg1 < 0) ? -arg1: arg1); } int16 -int2abs(int16 arg1) +int2abs(Datum arg1) { - return ((arg1 < 0) ? -arg1 : arg1); + return ((arg1 < 0) ? -arg1: arg1); } int16 -int2larger(int16 arg1, int16 arg2) +int2larger(Datum arg1, Datum arg2) { - return (arg1 > arg2) ? arg1 : arg2; + return ((int16)arg1 > (int16)arg2) ? (int16)arg1 : (int16)arg2; } int16 -int2smaller(int16 arg1, int16 arg2) +int2smaller(Datum arg1, Datum arg2) { - return (arg1 < arg2) ? arg1 : arg2; + return ((int16)arg1 < (int16)arg2) ? (int16)arg1 : (int16)arg2; } int32 -int4larger(int32 arg1, int32 arg2) +int4larger(Datum arg1, Datum arg2) { - return (arg1 > arg2) ? arg1 : arg2; + return ((int32)arg1 > (int32)arg2) ? (int32)arg1 : (int32)arg2; } int32 -int4smaller(int32 arg1, int32 arg2) +int4smaller(Datum arg1, Datum arg2) { - return (arg1 < arg2) ? arg1 : arg2; + return ((int32)arg1 < (int32)arg2) ? (int32)arg1 : (int32)arg2; } --- backend/utils/adt/int8.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/int8.c Mon Feb 12 21:28:48 2001 @@ -176,57 +176,57 @@ * Is 64-bit val1 relop 32-bit val2? */ bool -int84eq(int64 *val1, int32 val2) +int84eq(int64 *val1, Datum val2) { if (!val1) return 0; - return *val1 == val2; + return *val1 == (int32)val2; } /* int84eq() */ bool -int84ne(int64 *val1, int32 val2) +int84ne(int64 *val1, Datum val2) { if (!val1) return 0; - return *val1 != val2; + return *val1 != (int32)val2; } /* int84ne() */ bool -int84lt(int64 *val1, int32 val2) +int84lt(int64 *val1, Datum val2) { if (!val1) return 0; - return *val1 < val2; + return *val1 < (int32)val2; } /* int84lt() */ bool -int84gt(int64 *val1, int32 val2) +int84gt(int64 *val1, Datum val2) { if (!val1) return 0; - return *val1 > val2; + return *val1 > (int32)val2; } /* int84gt() */ bool -int84le(int64 *val1, int32 val2) +int84le(int64 *val1, Datum val2) { if (!val1) return 0; - return *val1 <= val2; + return *val1 <= (int32)val2; } /* int84le() */ bool -int84ge(int64 *val1, int32 val2) +int84ge(int64 *val1, Datum val2) { if (!val1) return 0; - return *val1 >= val2; + return *val1 >= (int32)val2; } /* int84ge() */ @@ -234,57 +234,57 @@ * Is 32-bit val1 relop 64-bit val2? */ bool -int48eq(int32 val1, int64 *val2) +int48eq(Datum val1, int64 *val2) { if (!val2) return 0; - return val1 == *val2; + return (int32)val1 == *val2; } /* int48eq() */ bool -int48ne(int32 val1, int64 *val2) +int48ne(Datum val1, int64 *val2) { if (!val2) return 0; - return val1 != *val2; + return (int32)val1 != *val2; } /* int48ne() */ bool -int48lt(int32 val1, int64 *val2) +int48lt(Datum val1, int64 *val2) { if (!val2) return 0; - return val1 < *val2; + return (int32)val1 < *val2; } /* int48lt() */ bool -int48gt(int32 val1, int64 *val2) +int48gt(Datum val1, int64 *val2) { if (!val2) return 0; - return val1 > *val2; + return (int32)val1 > *val2; } /* int48gt() */ bool -int48le(int32 val1, int64 *val2) +int48le(Datum val1, int64 *val2) { if (!val2) return 0; - return val1 <= *val2; + return (int32)val1 <= *val2; } /* int48le() */ bool -int48ge(int32 val1, int64 *val2) +int48ge(Datum val1, int64 *val2) { if (!val2) return 0; - return val1 >= *val2; + return (int32)val1 >= *val2; } /* int48ge() */ @@ -444,106 +444,106 @@ int64 * -int84pl(int64 *val1, int32 val2) +int84pl(int64 *val1, Datum val2) { int64 *result = palloc(sizeof(int64)); if (!PointerIsValid(val1)) return NULL; - *result = *val1 + (int64) val2; + *result = *val1 + (int32) val2; return result; } /* int84pl() */ int64 * -int84mi(int64 *val1, int32 val2) +int84mi(int64 *val1, Datum val2) { int64 *result = palloc(sizeof(int64)); if (!PointerIsValid(val1)) return NULL; - *result = *val1 - (int64) val2; + *result = *val1 - (int32) val2; return result; } /* int84mi() */ int64 * -int84mul(int64 *val1, int32 val2) +int84mul(int64 *val1, Datum val2) { int64 *result = palloc(sizeof(int64)); if (!PointerIsValid(val1)) return NULL; - *result = *val1 * (int64) val2; + *result = *val1 * (int32) val2; return result; } /* int84mul() */ int64 * -int84div(int64 *val1, int32 val2) +int84div(int64 *val1, Datum val2) { int64 *result = palloc(sizeof(int64)); if (!PointerIsValid(val1)) return NULL; - *result = *val1 / (int64) val2; + *result = *val1 / (int32) val2; return result; } /* int84div() */ int64 * -int48pl(int32 val1, int64 *val2) +int48pl(Datum val1, int64 *val2) { int64 *result = palloc(sizeof(int64)); if (!PointerIsValid(val2)) return NULL; - *result = (int64) val1 + *val2; + *result = (int32) val1 + *val2; return result; } /* int48pl() */ int64 * -int48mi(int32 val1, int64 *val2) +int48mi(Datum val1, int64 *val2) { int64 *result = palloc(sizeof(int64)); if (!PointerIsValid(val2)) return NULL; - *result = (int64) val1 - *val2; + *result = (int32) val1 - *val2; return result; } /* int48mi() */ int64 * -int48mul(int32 val1, int64 *val2) +int48mul(Datum val1, int64 *val2) { int64 *result = palloc(sizeof(int64)); if (!PointerIsValid(val2)) return NULL; - *result = (int64) val1 **val2; + *result = (int32) val1 **val2; return result; } /* int48mul() */ int64 * -int48div(int32 val1, int64 *val2) +int48div(Datum val1, int64 *val2) { int64 *result = palloc(sizeof(int64)); if (!PointerIsValid(val2)) return NULL; - *result = (int64) val1 / *val2; + *result = (int32) val1 / *val2; return result; } /* int48div() */ @@ -554,11 +554,11 @@ *---------------------------------------------------------*/ int64 * -int48(int32 val) +int48(Datum val) { int64 *result = palloc(sizeof(int64)); - *result = val; + *result = (int32)val; return result; } /* int48() */ --- backend/utils/adt/nabstime.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/nabstime.c Mon Feb 12 21:28:48 2001 @@ -209,11 +209,11 @@ void -abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn) +abstime2tm(Datum time, int *tzp, struct tm * tm, char *tzn) { #ifdef USE_POSIX_TIME struct tm *tx; - + time_t t = (time_t) time; #else /* ! USE_POSIX_TIME */ struct timeb tb; /* the old V7-ism */ @@ -222,10 +222,10 @@ #ifdef USE_POSIX_TIME if (tzp != NULL) - tx = localtime((time_t *) &time); + tx = localtime( &t ); else { - tx = gmtime((time_t *) &time); + tx = gmtime( &t ); }; #endif @@ -304,8 +304,8 @@ static AbsoluteTime tm2abstime(struct tm * tm, int tz) { - int day, - sec; + int day; + AbsoluteTime sec; /* validate, before going out of range on some members */ if (tm->tm_year < 1901 || tm->tm_year > 2038 @@ -407,8 +407,9 @@ * Given an AbsoluteTime return the English text version of the date */ char * -nabstimeout(AbsoluteTime time) +nabstimeout(Datum t) { + AbsoluteTime time = (AbsoluteTime) t; char *result; int tz; double fsec = 0; @@ -453,8 +454,10 @@ * AbsoluteTimeIsBefore -- true iff time1 is after time2. */ bool -AbsoluteTimeIsBefore(AbsoluteTime time1, AbsoluteTime time2) +AbsoluteTimeIsBefore(Datum t1, Datum t2) { + AbsoluteTime time1 = t1, time2 = t2; + Assert(AbsoluteTimeIsValid(time1)); Assert(AbsoluteTimeIsValid(time2)); @@ -469,8 +472,10 @@ #ifdef NOT_USED bool -AbsoluteTimeIsAfter(AbsoluteTime time1, AbsoluteTime time2) +AbsoluteTimeIsAfter(Datum t1, Datum t2) { + AbsoluteTime time1 = t1, time2 = t2; + Assert(AbsoluteTimeIsValid(time1)); Assert(AbsoluteTimeIsValid(time2)); @@ -488,8 +493,10 @@ /* abstime_finite() */ bool -abstime_finite(AbsoluteTime abstime) +abstime_finite(Datum d) { + AbsoluteTime abstime = (AbsoluteTime) d; + return ((abstime != INVALID_ABSTIME) && (abstime != NOSTART_ABSTIME) && (abstime != NOEND_ABSTIME)); } /* abstime_finite() */ @@ -504,8 +511,10 @@ * abstimege - returns 1, iff t1 greater than or equal to t2 */ bool -abstimeeq(AbsoluteTime t1, AbsoluteTime t2) +abstimeeq(Datum d1, Datum d2) { + AbsoluteTime t1 = d1, t2 = d2; + if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) return FALSE; if (t1 == CURRENT_ABSTIME) @@ -517,8 +526,10 @@ } bool -abstimene(AbsoluteTime t1, AbsoluteTime t2) +abstimene(Datum d1, Datum d2) { + AbsoluteTime t1 = d1, t2 = d2; + if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) return FALSE; if (t1 == CURRENT_ABSTIME) @@ -530,8 +541,10 @@ } bool -abstimelt(AbsoluteTime t1, AbsoluteTime t2) +abstimelt(Datum d1, Datum d2) { + AbsoluteTime t1 = d1, t2 = d2; + if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) return FALSE; if (t1 == CURRENT_ABSTIME) @@ -543,8 +556,10 @@ } bool -abstimegt(AbsoluteTime t1, AbsoluteTime t2) +abstimegt(Datum d1, Datum d2) { + AbsoluteTime t1 = d1, t2 = d2; + if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) return FALSE; if (t1 == CURRENT_ABSTIME) @@ -556,8 +571,10 @@ } bool -abstimele(AbsoluteTime t1, AbsoluteTime t2) +abstimele(Datum d1, Datum d2) { + AbsoluteTime t1 = d1, t2 = d2; + if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) return FALSE; if (t1 == CURRENT_ABSTIME) @@ -569,8 +586,10 @@ } bool -abstimege(AbsoluteTime t1, AbsoluteTime t2) +abstimege(Datum d1, Datum d2) { + AbsoluteTime t1 = d1, t2 = d2; + if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME) return FALSE; if (t1 == CURRENT_ABSTIME) @@ -640,8 +659,9 @@ * Convert abstime to timestamp. */ Timestamp * -abstime_timestamp(AbsoluteTime abstime) +abstime_timestamp(Datum d) { + AbsoluteTime abstime = (AbsoluteTime)d; Timestamp *result; if (!PointerIsValid(result = palloc(sizeof(Timestamp)))) @@ -729,8 +749,9 @@ * reltimeout - converts the internal format to a reltime string */ char * -reltimeout(RelativeTime time) +reltimeout(Datum t) { + RelativeTime time = (RelativeTime) t; char *result; struct tm tt, *tm = &tt; @@ -755,8 +776,10 @@ static void -reltime2tm(RelativeTime time, struct tm * tm) +reltime2tm(RelativeTime t, struct tm * tm) { + RelativeTime time = (RelativeTime) t; + TMODULO(time, tm->tm_year, 31536000); TMODULO(time, tm->tm_mon, 2592000); TMODULO(time, tm->tm_mday, 86400); @@ -916,8 +939,9 @@ Interval * -reltime_interval(RelativeTime reltime) +reltime_interval(Datum d) { + RelativeTime reltime = d; Interval *result; int year, month; @@ -947,8 +971,9 @@ * mktinterval - creates a time interval with endpoints t1 and t2 */ TimeInterval -mktinterval(AbsoluteTime t1, AbsoluteTime t2) +mktinterval(Datum d1, Datum d2) { + AbsoluteTime t1 = d1, t2 = d2; AbsoluteTime tstart = ABSTIMEMIN(t1, t2), tend = ABSTIMEMAX(t1, t2); TimeInterval interval; @@ -977,8 +1002,10 @@ * timepl - returns the value of (abstime t1 + relime t2) */ AbsoluteTime -timepl(AbsoluteTime t1, RelativeTime t2) +timepl(Datum d1, Datum d2) { + AbsoluteTime t1 = d1; + RelativeTime t2 = d2; if (t1 == CURRENT_ABSTIME) t1 = GetCurrentTransactionStartTime(); @@ -996,8 +1023,11 @@ * timemi - returns the value of (abstime t1 - reltime t2) */ AbsoluteTime -timemi(AbsoluteTime t1, RelativeTime t2) +timemi(Datum d1, Datum d2) { + AbsoluteTime t1 = d1; + RelativeTime t2 = d2; + if (t1 == CURRENT_ABSTIME) t1 = GetCurrentTransactionStartTime(); @@ -1015,8 +1045,10 @@ * abstimemi - returns the value of (abstime t1 - abstime t2) */ static RelativeTime -abstimemi(AbsoluteTime t1, AbsoluteTime t2) +abstimemi(Datum d1, Datum d2) { + AbsoluteTime t1 = d1, t2 = d2; + if (t1 == CURRENT_ABSTIME) t1 = GetCurrentTransactionStartTime(); if (t2 == CURRENT_ABSTIME) @@ -1034,7 +1066,7 @@ * intinterval - returns 1, iff absolute date is in the interval */ int -intinterval(AbsoluteTime t, TimeInterval interval) +intinterval(Datum t, TimeInterval interval) { if (interval->status == T_INTERVAL_VALID && t != INVALID_ABSTIME) return (abstimege(t, interval->data[0]) && @@ -1048,6 +1080,7 @@ RelativeTime tintervalrel(TimeInterval interval) { + if (interval->status == T_INTERVAL_VALID) return abstimemi(interval->data[1], interval->data[0]); else @@ -1078,51 +1111,57 @@ * reltimege - returns 1, iff t1 greater than or equal to t2 */ bool -reltimeeq(RelativeTime t1, RelativeTime t2) +reltimeeq(Datum t1, Datum t2) { - if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME) + if ((RelativeTime)t1 == INVALID_RELTIME + || (RelativeTime)t2 == INVALID_RELTIME) return 0; - return t1 == t2; + return (RelativeTime)t1 == (RelativeTime)t2; } bool -reltimene(RelativeTime t1, RelativeTime t2) +reltimene(Datum t1, Datum t2) { - if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME) + if ((RelativeTime)t1 == INVALID_RELTIME + || (RelativeTime)t2 == INVALID_RELTIME) return 0; - return t1 != t2; + return (RelativeTime)t1 != (RelativeTime)t2; } bool -reltimelt(RelativeTime t1, RelativeTime t2) +reltimelt(Datum t1, Datum t2) { - if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME) + if ((RelativeTime)t1 == INVALID_RELTIME + || (RelativeTime)t2 == INVALID_RELTIME) return 0; - return t1 < t2; + return (RelativeTime)t1 < (RelativeTime)t2; } bool -reltimegt(RelativeTime t1, RelativeTime t2) +reltimegt(Datum t1, Datum t2) { - if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME) + if ((RelativeTime)t1 == INVALID_RELTIME + || (RelativeTime)t2 == INVALID_RELTIME) return 0; - return t1 > t2; + return (RelativeTime)t1 > (RelativeTime)t2; } bool -reltimele(RelativeTime t1, RelativeTime t2) +reltimele(Datum t1, Datum t2) { - if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME) + if ((RelativeTime)t1 == INVALID_RELTIME + || (RelativeTime)t2 == INVALID_RELTIME) return 0; - return t1 <= t2; + return (RelativeTime)t1 <= (RelativeTime)t2; } bool -reltimege(RelativeTime t1, RelativeTime t2) +reltimege(Datum t1, Datum t2) { - if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME) + if ((RelativeTime)t1 == INVALID_RELTIME + || (RelativeTime)t2 == INVALID_RELTIME) return 0; - return t1 >= t2; + return (RelativeTime)t1 >= (RelativeTime)t2; } @@ -1362,8 +1401,9 @@ * reltime t */ bool -tintervalleneq(TimeInterval i, RelativeTime t) +tintervalleneq(TimeInterval i, Datum d) { + RelativeTime t = d; RelativeTime rt; if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME)) @@ -1377,8 +1417,9 @@ * to reltime t */ bool -tintervallenne(TimeInterval i, RelativeTime t) +tintervallenne(TimeInterval i, Datum d) { + RelativeTime t = d; RelativeTime rt; if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME)) @@ -1392,8 +1433,9 @@ * reltime t */ bool -tintervallenlt(TimeInterval i, RelativeTime t) +tintervallenlt(TimeInterval i, Datum d) { + RelativeTime t = d; RelativeTime rt; if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME)) @@ -1407,8 +1449,9 @@ * reltime t */ bool -tintervallengt(TimeInterval i, RelativeTime t) +tintervallengt(TimeInterval i, Datum d) { + RelativeTime t = d; RelativeTime rt; if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME)) @@ -1422,8 +1465,9 @@ * than reltime t */ bool -tintervallenle(TimeInterval i, RelativeTime t) +tintervallenle(TimeInterval i, Datum d) { + RelativeTime t = d; RelativeTime rt; if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME)) @@ -1437,8 +1481,9 @@ * equal than reltime t */ bool -tintervallenge(TimeInterval i, RelativeTime t) +tintervallenge(TimeInterval i, Datum d) { + RelativeTime t = d; RelativeTime rt; if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME)) --- backend/utils/adt/numeric.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/numeric.c Mon Feb 12 21:28:48 2001 @@ -187,7 +187,7 @@ * ---------- */ Numeric -numeric_in(char *str, int dummy, int32 typmod) +numeric_in(char *str, int dummy, Datum typmod) { NumericVar value; Numeric res; @@ -217,7 +217,7 @@ init_var(&value); set_var_from_str(str, &value); - apply_typmod(&value, typmod); + apply_typmod(&value, (int32)typmod); res = make_result(&value); free_var(&value); @@ -1706,8 +1706,9 @@ Numeric -int4_numeric(int32 val) +int4_numeric(Datum v) { + int32 val = v; Numeric res; NumericVar result; char *tmp; --- backend/utils/adt/oid.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/oid.c Mon Feb 12 21:28:48 2001 @@ -185,17 +185,17 @@ } bool -oideqint4(Oid arg1, int32 arg2) +oideqint4(Oid arg1, Datum arg2) { /* oid is unsigned, but int4 is signed */ - return arg2 >= 0 && arg1 == arg2; + return (int32)arg2 >= 0 && arg1 == (int32)arg2; } bool -int4eqoid(int32 arg1, Oid arg2) +int4eqoid(Datum arg1, Oid arg2) { /* oid is unsigned, but int4 is signed */ - return arg1 >= 0 && arg1 == arg2; + return (int32)arg1 >= 0 && (int32)arg1 == arg2; } text * --- backend/utils/adt/varchar.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/varchar.c Mon Feb 12 21:28:48 2001 @@ -62,8 +62,9 @@ * because we pass typelem as the second argument for array_in.) */ char * -bpcharin(char *s, int dummy, int32 atttypmod) +bpcharin(char *s, Datum dummy, Datum a) { + int32 atttypmod = a; char *result, *r; int len; @@ -147,8 +148,9 @@ * len is the length specified in () plus VARHDRSZ bytes. */ char * -bpchar(char *s, int32 len) +bpchar(char *s, Datum l) { + int32 len = l; char *result, *r; int rlen, @@ -219,9 +221,9 @@ * len is the length specified in () plus VARHDRSZ bytes. */ ArrayType * -_bpchar(ArrayType *v, int32 len) +_bpchar(ArrayType *v, Datum len) { - return array_map(v, BPCHAROID, bpchar, BPCHAROID, 1, len); + return array_map(v, BPCHAROID, bpchar, BPCHAROID, 1, (int32)len); } @@ -238,7 +240,7 @@ * Convert char to bpchar(1). */ char * -char_bpchar(int32 c) +char_bpchar(Datum c) { char *result; @@ -330,8 +332,9 @@ * because we pass typelem as the second argument for array_in.) */ char * -varcharin(char *s, int dummy, int32 atttypmod) +varcharin(char *s, int dummy, Datum a) { + int32 atttypmod = a; char *result; int len; @@ -392,8 +395,9 @@ * slen is the length specified in () plus VARHDRSZ bytes. */ char * -varchar(char *s, int32 slen) +varchar(char *s, Datum ds) { + int32 slen = ds; char *result; int len; @@ -430,9 +434,9 @@ * len is the length specified in () plus VARHDRSZ bytes. */ ArrayType * -_varchar(ArrayType *v, int32 len) +_varchar(ArrayType *v, Datum len) { - return array_map(v, VARCHAROID, varchar, VARCHAROID, 1, len); + return array_map(v, VARCHAROID, varchar, VARCHAROID, 1, (int32)len); } --- backend/utils/adt/varlena.c.orig Mon Feb 12 21:28:48 2001 +++ backend/utils/adt/varlena.c Mon Feb 12 21:28:48 2001 @@ -324,8 +324,9 @@ * - Thomas Lockhart 1998-12-10 */ text * -text_substr(text *string, int32 m, int32 n) +text_substr(text *string, Datum dm, Datum dn) { + int32 m = dm, n = dn; text *ret; int len; --- include/access/hash.h.orig Mon Feb 12 21:28:43 2001 +++ include/access/hash.h Mon Feb 12 21:28:43 2001 @@ -263,15 +263,15 @@ extern void hashdelete(Relation rel, ItemPointer tid); /* hashfunc.c */ -extern uint32 hashint2(int16 key); -extern uint32 hashint4(uint32 key); +extern uint32 hashint2(Datum key); +extern uint32 hashint4(Datum key); extern uint32 hashint8(int64 *key); extern uint32 hashfloat4(float32 keyp); extern uint32 hashfloat8(float64 keyp); extern uint32 hashoid(Oid key); extern uint32 hashoidvector(Oid *key); extern uint32 hashint2vector(int16 *key); -extern uint32 hashchar(char key); +extern uint32 hashchar(Datum key); extern uint32 hashtext(struct varlena * key); extern uint32 hashname(NameData *n); --- include/utils/builtins.h.orig Mon Feb 12 21:28:43 2001 +++ include/utils/builtins.h Mon Feb 12 21:28:43 2001 @@ -55,95 +55,95 @@ /* char.c */ extern int32 charin(char *ch); -extern char *charout(int32 ch); +extern char *charout(Datum ch); extern int32 cidin(char *s); -extern char *cidout(int32 c); -extern bool chareq(int8 arg1, int8 arg2); -extern bool charne(int8 arg1, int8 arg2); -extern bool charlt(int8 arg1, int8 arg2); -extern bool charle(int8 arg1, int8 arg2); -extern bool chargt(int8 arg1, int8 arg2); -extern bool charge(int8 arg1, int8 arg2); -extern int8 charpl(int8 arg1, int8 arg2); -extern int8 charmi(int8 arg1, int8 arg2); -extern int8 charmul(int8 arg1, int8 arg2); -extern int8 chardiv(int8 arg1, int8 arg2); -extern bool cideq(int8 arg1, int8 arg2); +extern char *cidout(Datum c); +extern bool chareq(Datum arg1, Datum arg2); +extern bool charne(Datum arg1, Datum arg2); +extern bool charlt(Datum arg1, Datum arg2); +extern bool charle(Datum arg1, Datum arg2); +extern bool chargt(Datum arg1, Datum arg2); +extern bool charge(Datum arg1, Datum arg2); +extern int8 charpl(Datum arg1, Datum arg2); +extern int8 charmi(Datum arg1, Datum arg2); +extern int8 charmul(Datum arg1, Datum arg2); +extern int8 chardiv(Datum arg1, Datum arg2); +extern bool cideq(Datum arg1, Datum arg2); extern int8 text_char(text *arg1); -extern text *char_text(int8 arg1); +extern text *char_text(Datum arg1); /* int.c */ extern int32 int2in(char *num); -extern char *int2out(int16 sh); +extern char *int2out(Datum sh); extern int16 *int2vectorin(char *shs); extern char *int2vectorout(int16 *shs); extern bool int2vectoreq(int16 *arg1, int16 *arg2); extern int32 *int44in(char *input_string); extern char *int44out(int32 *an_array); extern int32 int4in(char *num); -extern char *int4out(int32 l); -extern int32 i2toi4(int16 arg1); -extern int16 i4toi2(int32 arg1); -extern text *int2_text(int16 arg1); +extern char *int4out(Datum l); +extern int32 i2toi4(Datum arg1); +extern int16 i4toi2(Datum arg1); +extern text *int2_text(Datum arg1); extern int16 text_int2(text *arg1); -extern text *int4_text(int32 arg1); +extern text *int4_text(Datum arg1); extern int32 text_int4(text *arg1); -extern bool int4eq(int32 arg1, int32 arg2); -extern bool int4ne(int32 arg1, int32 arg2); -extern bool int4lt(int32 arg1, int32 arg2); -extern bool int4le(int32 arg1, int32 arg2); -extern bool int4gt(int32 arg1, int32 arg2); -extern bool int4ge(int32 arg1, int32 arg2); -extern bool int2eq(int16 arg1, int16 arg2); -extern bool int2ne(int16 arg1, int16 arg2); -extern bool int2lt(int16 arg1, int16 arg2); -extern bool int2le(int16 arg1, int16 arg2); -extern bool int2gt(int16 arg1, int16 arg2); -extern bool int2ge(int16 arg1, int16 arg2); -extern bool int24eq(int32 arg1, int32 arg2); -extern bool int24ne(int32 arg1, int32 arg2); -extern bool int24lt(int32 arg1, int32 arg2); -extern bool int24le(int32 arg1, int32 arg2); -extern bool int24gt(int32 arg1, int32 arg2); -extern bool int24ge(int32 arg1, int32 arg2); -extern bool int42eq(int32 arg1, int32 arg2); -extern bool int42ne(int32 arg1, int32 arg2); -extern bool int42lt(int32 arg1, int32 arg2); -extern bool int42le(int32 arg1, int32 arg2); -extern bool int42gt(int32 arg1, int32 arg2); -extern bool int42ge(int32 arg1, int32 arg2); -extern int32 int4um(int32 arg); -extern int32 int4pl(int32 arg1, int32 arg2); -extern int32 int4mi(int32 arg1, int32 arg2); -extern int32 int4mul(int32 arg1, int32 arg2); -extern int32 int4div(int32 arg1, int32 arg2); -extern int32 int4abs(int32 arg); -extern int32 int4inc(int32 arg); -extern int16 int2um(int16 arg); -extern int16 int2pl(int16 arg1, int16 arg2); -extern int16 int2mi(int16 arg1, int16 arg2); -extern int16 int2mul(int16 arg1, int16 arg2); -extern int16 int2div(int16 arg1, int16 arg2); -extern int16 int2abs(int16 arg); -extern int16 int2inc(int16 arg); -extern int32 int24pl(int32 arg1, int32 arg2); -extern int32 int24mi(int32 arg1, int32 arg2); -extern int32 int24mul(int32 arg1, int32 arg2); -extern int32 int24div(int32 arg1, int32 arg2); -extern int32 int42pl(int32 arg1, int32 arg2); -extern int32 int42mi(int32 arg1, int32 arg2); -extern int32 int42mul(int32 arg1, int32 arg2); -extern int32 int42div(int32 arg1, int32 arg2); -extern int32 int4mod(int32 arg1, int32 arg2); -extern int32 int2mod(int16 arg1, int16 arg2); -extern int32 int24mod(int32 arg1, int32 arg2); -extern int32 int42mod(int32 arg1, int32 arg2); -extern int32 int4fac(int32 arg1); -extern int32 int2fac(int16 arg1); -extern int16 int2larger(int16 arg1, int16 arg2); -extern int16 int2smaller(int16 arg1, int16 arg2); -extern int32 int4larger(int32 arg1, int32 arg2); -extern int32 int4smaller(int32 arg1, int32 arg2); +extern bool int4eq(Datum arg1, Datum arg2); +extern bool int4ne(Datum arg1, Datum arg2); +extern bool int4lt(Datum arg1, Datum arg2); +extern bool int4le(Datum arg1, Datum arg2); +extern bool int4gt(Datum arg1, Datum arg2); +extern bool int4ge(Datum arg1, Datum arg2); +extern bool int2eq(Datum arg1, Datum arg2); +extern bool int2ne(Datum arg1, Datum arg2); +extern bool int2lt(Datum arg1, Datum arg2); +extern bool int2le(Datum arg1, Datum arg2); +extern bool int2gt(Datum arg1, Datum arg2); +extern bool int2ge(Datum arg1, Datum arg2); +extern bool int24eq(Datum arg1, Datum arg2); +extern bool int24ne(Datum arg1, Datum arg2); +extern bool int24lt(Datum arg1, Datum arg2); +extern bool int24le(Datum arg1, Datum arg2); +extern bool int24gt(Datum arg1, Datum arg2); +extern bool int24ge(Datum arg1, Datum arg2); +extern bool int42eq(Datum arg1, Datum arg2); +extern bool int42ne(Datum arg1, Datum arg2); +extern bool int42lt(Datum arg1, Datum arg2); +extern bool int42le(Datum arg1, Datum arg2); +extern bool int42gt(Datum arg1, Datum arg2); +extern bool int42ge(Datum arg1, Datum arg2); +extern int32 int4um(Datum arg); +extern int32 int4pl(Datum arg1, Datum arg2); +extern int32 int4mi(Datum arg1, Datum arg2); +extern int32 int4mul(Datum arg1, Datum arg2); +extern int32 int4div(Datum arg1, Datum arg2); +extern int32 int4abs(Datum arg); +extern int32 int4inc(Datum arg); +extern int16 int2um(Datum arg); +extern int16 int2pl(Datum arg1, Datum arg2); +extern int16 int2mi(Datum arg1, Datum arg2); +extern int16 int2mul(Datum arg1, Datum arg2); +extern int16 int2div(Datum arg1, Datum arg2); +extern int16 int2abs(Datum arg); +extern int16 int2inc(Datum arg); +extern int32 int24pl(Datum arg1, Datum arg2); +extern int32 int24mi(Datum arg1, Datum arg2); +extern int32 int24mul(Datum arg1, Datum arg2); +extern int32 int24div(Datum arg1, Datum arg2); +extern int32 int42pl(Datum arg1, Datum arg2); +extern int32 int42mi(Datum arg1, Datum arg2); +extern int32 int42mul(Datum arg1, Datum arg2); +extern int32 int42div(Datum arg1, Datum arg2); +extern int32 int4mod(Datum arg1, Datum arg2); +extern int32 int2mod(Datum arg1, Datum arg2); +extern int32 int24mod(Datum arg1, Datum arg2); +extern int32 int42mod(Datum arg1, Datum arg2); +extern int32 int4fac(Datum arg1); +extern int32 int2fac(Datum arg1); +extern int16 int2larger(Datum arg1, Datum arg2); +extern int16 int2smaller(Datum arg1, Datum arg2); +extern int32 int4larger(Datum arg1, Datum arg2); +extern int32 int4smaller(Datum arg1, Datum arg2); /* name.c */ extern NameData *namein(const char *s); @@ -177,17 +177,17 @@ * Per-opclass comparison functions for new btrees. These are * stored in pg_amproc and defined in nbtree/ */ -extern int32 btint2cmp(int16 a, int16 b); -extern int32 btint4cmp(int32 a, int32 b); +extern int32 btint2cmp(Datum a, Datum b); +extern int32 btint4cmp(Datum a, Datum b); extern int32 btint8cmp(int64 *a, int64 *b); -extern int32 btint24cmp(int16 a, int32 b); -extern int32 btint42cmp(int32 a, int16 b); +extern int32 btint24cmp(Datum a, Datum b); +extern int32 btint42cmp(Datum a, Datum b); extern int32 btfloat4cmp(float32 a, float32 b); extern int32 btfloat8cmp(float64 a, float64 b); extern int32 btoidcmp(Oid a, Oid b); extern int32 btoidvectorcmp(Oid *a, Oid *b); -extern int32 btabstimecmp(AbsoluteTime a, AbsoluteTime b); -extern int32 btcharcmp(char a, char b); +extern int32 btabstimecmp(Datum a, Datum b); +extern int32 btcharcmp(Datum a, Datum b); extern int32 btnamecmp(NameData *a, NameData *b); extern int32 bttextcmp(struct varlena * a, struct varlena * b); extern int32 btboolcmp(bool a, bool b); @@ -252,13 +252,13 @@ extern bool float8gt(float64 arg1, float64 arg2); extern bool float8ge(float64 arg1, float64 arg2); extern float64 ftod(float32 num); -extern float64 i4tod(int32 num); -extern float64 i2tod(int16 num); +extern float64 i4tod(Datum num); +extern float64 i2tod(Datum num); extern float32 dtof(float64 num); extern int32 dtoi4(float64 num); extern int16 dtoi2(float64 num); -extern float32 i4tof(int32 num); -extern float32 i2tof(int16 num); +extern float32 i4tof(Datum num); +extern float32 i2tof(Datum num); extern int32 ftoi4(float32 num); extern int16 ftoi2(float32 num); extern float64 text_float8(text *str); @@ -337,8 +337,8 @@ extern bool oidvectorle(Oid *arg1, Oid *arg2); extern bool oidvectorge(Oid *arg1, Oid *arg2); extern bool oidvectorgt(Oid *arg1, Oid *arg2); -extern bool oideqint4(Oid arg1, int32 arg2); -extern bool int4eqoid(int32 arg1, Oid arg2); +extern bool oideqint4(Oid arg1, Datum arg2); +extern bool int4eqoid(Datum arg1, Oid arg2); extern text *oid_text(Oid arg1); extern Oid text_oid(text *arg1); @@ -461,11 +461,11 @@ extern ItemPointer currtid_byrelname(const text *relName, ItemPointer); /* varchar.c */ -extern char *bpcharin(char *s, int dummy, int32 atttypmod); +extern char *bpcharin(char *s, Datum dummy, Datum atttypmod); extern char *bpcharout(char *s); -extern char *bpchar(char *s, int32 slen); -extern ArrayType *_bpchar(ArrayType *v, int32 slen); -extern char *char_bpchar(int32 c); +extern char *bpchar(char *s, Datum slen); +extern ArrayType *_bpchar(ArrayType *v, Datum slen); +extern char *char_bpchar(Datum c); extern int32 bpchar_char(char *s); extern char *name_bpchar(NameData *s); extern NameData *bpchar_name(char *s); @@ -480,10 +480,10 @@ extern int32 bpcharoctetlen(char *arg); extern uint32 hashbpchar(struct varlena * key); -extern char *varcharin(char *s, int dummy, int32 atttypmod); +extern char *varcharin(char *s, int dummy, Datum atttypmod); extern char *varcharout(char *s); -extern char *varchar(char *s, int32 slen); -extern ArrayType *_varchar(ArrayType *v, int32 slen); +extern char *varchar(char *s, Datum slen); +extern ArrayType *_varchar(ArrayType *v, Datum slen); extern bool varchareq(char *arg1, char *arg2); extern bool varcharne(char *arg1, char *arg2); extern bool varcharlt(char *arg1, char *arg2); @@ -511,7 +511,7 @@ extern int32 textlen(text *arg); extern int32 textoctetlen(text *arg); extern int32 textpos(text *arg1, text *arg2); -extern text *text_substr(text *string, int32 m, int32 n); +extern text *text_substr(text *string, Datum m, Datum n); extern text *name_text(NameData *s); extern NameData *text_name(text *s); @@ -590,7 +590,7 @@ extern text *macaddr_manuf(macaddr *addr); /* numeric.c */ -extern Numeric numeric_in(char *str, int dummy, int32 typmod); +extern Numeric numeric_in(char *str, int dummy, Datum typmod); extern char *numeric_out(Numeric num); extern Numeric numeric(Numeric num, int32 typmod); extern Numeric numeric_abs(Numeric num); @@ -621,7 +621,7 @@ extern Numeric numeric_ln(Numeric num); extern Numeric numeric_log(Numeric num1, Numeric num2); extern Numeric numeric_power(Numeric num1, Numeric num2); -extern Numeric int4_numeric(int32 val); +extern Numeric int4_numeric(Datum val); extern int32 numeric_int4(Numeric num); extern Numeric int8_numeric(int64 *val); extern int64 *numeric_int8(Numeric num); --- include/utils/int8.h.orig Mon Feb 12 21:28:43 2001 +++ include/utils/int8.h Mon Feb 12 21:28:43 2001 @@ -57,19 +57,19 @@ extern bool int8le(int64 *val1, int64 *val2); extern bool int8ge(int64 *val1, int64 *val2); -extern bool int84eq(int64 *val1, int32 val2); -extern bool int84ne(int64 *val1, int32 val2); -extern bool int84lt(int64 *val1, int32 val2); -extern bool int84gt(int64 *val1, int32 val2); -extern bool int84le(int64 *val1, int32 val2); -extern bool int84ge(int64 *val1, int32 val2); +extern bool int84eq(int64 *val1, Datum val2); +extern bool int84ne(int64 *val1, Datum val2); +extern bool int84lt(int64 *val1, Datum val2); +extern bool int84gt(int64 *val1, Datum val2); +extern bool int84le(int64 *val1, Datum val2); +extern bool int84ge(int64 *val1, Datum val2); -extern bool int48eq(int32 val1, int64 *val2); -extern bool int48ne(int32 val1, int64 *val2); -extern bool int48lt(int32 val1, int64 *val2); -extern bool int48gt(int32 val1, int64 *val2); -extern bool int48le(int32 val1, int64 *val2); -extern bool int48ge(int32 val1, int64 *val2); +extern bool int48eq(Datum val1, int64 *val2); +extern bool int48ne(Datum val1, int64 *val2); +extern bool int48lt(Datum val1, int64 *val2); +extern bool int48gt(Datum val1, int64 *val2); +extern bool int48le(Datum val1, int64 *val2); +extern bool int48ge(Datum val1, int64 *val2); extern int64 *int8um(int64 *val); extern int64 *int8pl(int64 *val1, int64 *val2); @@ -82,17 +82,17 @@ extern int64 *int8larger(int64 *val1, int64 *val2); extern int64 *int8smaller(int64 *val1, int64 *val2); -extern int64 *int84pl(int64 *val1, int32 val2); -extern int64 *int84mi(int64 *val1, int32 val2); -extern int64 *int84mul(int64 *val1, int32 val2); -extern int64 *int84div(int64 *val1, int32 val2); +extern int64 *int84pl(int64 *val1, Datum val2); +extern int64 *int84mi(int64 *val1, Datum val2); +extern int64 *int84mul(int64 *val1, Datum val2); +extern int64 *int84div(int64 *val1, Datum val2); -extern int64 *int48pl(int32 val1, int64 *val2); -extern int64 *int48mi(int32 val1, int64 *val2); -extern int64 *int48mul(int32 val1, int64 *val2); -extern int64 *int48div(int32 val1, int64 *val2); +extern int64 *int48pl(Datum val1, int64 *val2); +extern int64 *int48mi(Datum val1, int64 *val2); +extern int64 *int48mul(Datum val1, int64 *val2); +extern int64 *int48div(Datum val1, int64 *val2); -extern int64 *int48(int32 val); +extern int64 *int48(Datum val); extern int32 int84(int64 *val); #ifdef NOT_USED --- include/utils/nabstime.h.orig Mon Feb 12 21:28:43 2001 +++ include/utils/nabstime.h Mon Feb 12 21:28:43 2001 @@ -105,43 +105,43 @@ * nabstime.c prototypes */ extern AbsoluteTime nabstimein(char *timestr); -extern char *nabstimeout(AbsoluteTime time); +extern char *nabstimeout(Datum time); -extern bool abstimeeq(AbsoluteTime t1, AbsoluteTime t2); -extern bool abstimene(AbsoluteTime t1, AbsoluteTime t2); -extern bool abstimelt(AbsoluteTime t1, AbsoluteTime t2); -extern bool abstimegt(AbsoluteTime t1, AbsoluteTime t2); -extern bool abstimele(AbsoluteTime t1, AbsoluteTime t2); -extern bool abstimege(AbsoluteTime t1, AbsoluteTime t2); -extern bool abstime_finite(AbsoluteTime time); +extern bool abstimeeq(Datum t1, Datum t2); +extern bool abstimene(Datum t1, Datum t2); +extern bool abstimelt(Datum t1, Datum t2); +extern bool abstimegt(Datum t1, Datum t2); +extern bool abstimele(Datum t1, Datum t2); +extern bool abstimege(Datum t1, Datum t2); +extern bool abstime_finite(Datum time); extern AbsoluteTime timestamp_abstime(Timestamp *timestamp); -extern Timestamp *abstime_timestamp(AbsoluteTime abstime); +extern Timestamp *abstime_timestamp(Datum abstime); -extern bool AbsoluteTimeIsBefore(AbsoluteTime time1, AbsoluteTime time2); +extern bool AbsoluteTimeIsBefore(Datum time1, Datum time2); -extern void abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn); +extern void abstime2tm(Datum time, int *tzp, struct tm * tm, char *tzn); extern RelativeTime reltimein(char *timestring); -extern char *reltimeout(RelativeTime timevalue); +extern char *reltimeout(Datum timevalue); extern TimeInterval tintervalin(char *intervalstr); extern char *tintervalout(TimeInterval interval); extern RelativeTime interval_reltime(Interval *interval); -extern Interval *reltime_interval(RelativeTime reltime); -extern TimeInterval mktinterval(AbsoluteTime t1, AbsoluteTime t2); -extern AbsoluteTime timepl(AbsoluteTime t1, RelativeTime t2); -extern AbsoluteTime timemi(AbsoluteTime t1, RelativeTime t2); +extern Interval *reltime_interval(Datum reltime); +extern TimeInterval mktinterval(Datum t1, Datum t2); +extern AbsoluteTime timepl(Datum t1, Datum t2); +extern AbsoluteTime timemi(Datum t1, Datum t2); /* extern RelativeTime abstimemi(AbsoluteTime t1, AbsoluteTime t2); static*/ -extern int intinterval(AbsoluteTime t, TimeInterval interval); +extern int intinterval(Datum t, TimeInterval interval); extern RelativeTime tintervalrel(TimeInterval interval); extern AbsoluteTime timenow(void); -extern bool reltimeeq(RelativeTime t1, RelativeTime t2); -extern bool reltimene(RelativeTime t1, RelativeTime t2); -extern bool reltimelt(RelativeTime t1, RelativeTime t2); -extern bool reltimegt(RelativeTime t1, RelativeTime t2); -extern bool reltimele(RelativeTime t1, RelativeTime t2); -extern bool reltimege(RelativeTime t1, RelativeTime t2); +extern bool reltimeeq(Datum t1, Datum t2); +extern bool reltimene(Datum t1, Datum t2); +extern bool reltimelt(Datum t1, Datum t2); +extern bool reltimegt(Datum t1, Datum t2); +extern bool reltimele(Datum t1, Datum t2); +extern bool reltimege(Datum t1, Datum t2); extern bool tintervalsame(TimeInterval i1, TimeInterval i2); extern bool tintervaleq(TimeInterval i1, TimeInterval i2); extern bool tintervalne(TimeInterval i1, TimeInterval i2); @@ -149,12 +149,12 @@ extern bool tintervalgt(TimeInterval i1, TimeInterval i2); extern bool tintervalle(TimeInterval i1, TimeInterval i2); extern bool tintervalge(TimeInterval i1, TimeInterval i2); -extern bool tintervalleneq(TimeInterval i, RelativeTime t); -extern bool tintervallenne(TimeInterval i, RelativeTime t); -extern bool tintervallenlt(TimeInterval i, RelativeTime t); -extern bool tintervallengt(TimeInterval i, RelativeTime t); -extern bool tintervallenle(TimeInterval i, RelativeTime t); -extern bool tintervallenge(TimeInterval i, RelativeTime t); +extern bool tintervalleneq(TimeInterval i, Datum t); +extern bool tintervallenne(TimeInterval i, Datum t); +extern bool tintervallenlt(TimeInterval i, Datum t); +extern bool tintervallengt(TimeInterval i, Datum t); +extern bool tintervallenle(TimeInterval i, Datum t); +extern bool tintervallenge(TimeInterval i, Datum t); extern bool tintervalct(TimeInterval i1, TimeInterval i2); extern bool tintervalov(TimeInterval i1, TimeInterval i2); extern AbsoluteTime tintervalstart(TimeInterval i);