* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.48 1998/08/19 02:01:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.49 1998/08/24 19:04:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static bool BootstrapAlreadySeen(Oid id);
static int CompHash(char *str, int len);
static hashnode *FindStr(char *str, int length, hashnode *mderef);
-static int gettype(char *type);
+static Oid gettype(char *type);
static void cleanup(void);
/* ----------------
DefineAttr(char *name, char *type, int attnum)
{
int attlen;
- int t;
+ Oid typeoid;
if (reldesc != NULL)
{
closerel(relname);
}
- t = gettype(type);
+ typeoid = gettype(type);
if (attrtypes[attnum] == (AttributeTupleForm) NULL)
attrtypes[attnum] = AllocateAttribute();
if (Typ != (struct typmap **) NULL)
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
attlen = attrtypes[attnum]->attlen = Ap->am_typ.typlen;
attrtypes[attnum]->attbyval = Ap->am_typ.typbyval;
+ attrtypes[attnum]->attalign = Ap->am_typ.typalign;
}
else
{
- attrtypes[attnum]->atttypid = Procid[t].oid;
+ attrtypes[attnum]->atttypid = Procid[typeoid].oid;
namestrcpy(&attrtypes[attnum]->attname, name);
if (!Quiet)
printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
- attlen = attrtypes[attnum]->attlen = Procid[t].len;
- attrtypes[attnum]->attbyval = (attlen == 1) || (attlen == 2) || (attlen == 4);
+ attlen = attrtypes[attnum]->attlen = Procid[typeoid].len;
+ attrtypes[attnum]->attbyval = (attlen == 1) || (attlen == 2) ||(attlen == 4);
+ attrtypes[attnum]->attalign = 'i';
}
attrtypes[attnum]->attcacheoff = -1;
attrtypes[attnum]->atttypmod = -1;
* gettype
* ----------------
*/
-static int
+static Oid
gettype(char *type)
{
int i;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.52 1998/08/21 23:22:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.53 1998/08/24 19:04:04 momjian Exp $
*
*
* INTERFACE ROUTINES
funcTupDesc->attrs[0]->attbyval = ((TypeTupleForm) GETSTRUCT(tuple))->typbyval;
funcTupDesc->attrs[0]->attcacheoff = -1;
funcTupDesc->attrs[0]->atttypmod = -1;
+ funcTupDesc->attrs[0]->attalign = ((TypeTupleForm) GETSTRUCT(tuple))->typalign;
/*
* make the attributes name the same as the functions
* here we are indexing on a normal attribute (1...n)
* ----------------
*/
-
heapTupDesc = RelationGetTupleDescriptor(heapRelation);
atind = AttrNumberGetAttrOffset(atnum);
((AttributeTupleForm) to)->atthasdef = false;
((AttributeTupleForm) to)->attcacheoff = -1;
((AttributeTupleForm) to)->atttypmod = -1;
+ ((AttributeTupleForm) to)->attalign = 'i';
/*
* if the keytype is defined, we need to change the tuple form's
IndexKeyType->name);
((AttributeTupleForm) to)->atttypid = tup->t_oid;
((AttributeTupleForm) to)->attbyval =
- ((TypeTupleForm) ((char *) tup + tup->t_hoff))->typbyval;
-
+ ((TypeTupleForm) GETSTRUCT(tup))->typbyval;
((AttributeTupleForm) to)->attlen =
- ((TypeTupleForm) ((char *) tup + tup->t_hoff))->typlen;
-
+ ((TypeTupleForm) GETSTRUCT(tup))->typlen;
+ ((AttributeTupleForm) to)->attalign =
+ ((TypeTupleForm) GETSTRUCT(tup))->typalign;
((AttributeTupleForm) to)->atttypmod = IndexKeyType->typmod;
}