summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/lsyscache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-12-27 23:59:14 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-12-27 23:59:14 +0000
commit8609d4abf248f0eede4ed9505226da3f7e3e7c84 (patch)
tree39e5a813099835056d76dd385478069d01a8dcbf /src/backend/utils/cache/lsyscache.c
parent97799fc4757fd2699e0238254875994253659582 (diff)
Fix portability problems recently exposed by regression tests on Alphas.
1. Distinguish cases where a Datum representing a tuple datatype is an OID from cases where it is a pointer to TupleTableSlot, and make sure we use the right typlen in each case. 2. Make fetchatt() and related code support 8-byte by-value datatypes on machines where Datum is 8 bytes. Centralize knowledge of the available by-value datatype sizes in two macros in tupmacs.h, so that this will be easier if we ever have to do it again.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r--src/backend/utils/cache/lsyscache.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 24b2cbada95..905c9e1633b 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.48 2000/11/20 20:36:49 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.49 2000/12/27 23:59:12 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -15,6 +15,7 @@
*/
#include "postgres.h"
+#include "access/tupmacs.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
@@ -807,28 +808,8 @@ get_typdefault(Oid typid)
if (typByVal)
{
- int8 i8;
- int16 i16;
- int32 i32 = 0;
-
if (dataSize == typLen)
- {
- switch (typLen)
- {
- case sizeof(int8):
- memcpy((char *) &i8, VARDATA(typDefault), sizeof(int8));
- i32 = i8;
- break;
- case sizeof(int16):
- memcpy((char *) &i16, VARDATA(typDefault), sizeof(int16));
- i32 = i16;
- break;
- case sizeof(int32):
- memcpy((char *) &i32, VARDATA(typDefault), sizeof(int32));
- break;
- }
- returnValue = Int32GetDatum(i32);
- }
+ returnValue = fetch_att(VARDATA(typDefault), typByVal, typLen);
else
returnValue = PointerGetDatum(NULL);
}