Skip to content
Snippets Groups Projects
Commit c2fa275d authored by Tom Lane's avatar Tom Lane
Browse files

Correct hardwired type information in bootstrap.

parent 7bc1fbe1
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.75 2000/01/10 16:13:11 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.76 2000/01/11 04:00:30 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "utils/portal.h" #include "utils/portal.h"
#define ALLOC(t, c) (t *)calloc((unsigned)(c), sizeof(t)) #define ALLOC(t, c) (t *)calloc((unsigned)(c), sizeof(t))
#define FIRST_TYPE_OID 16 /* OID of the first type */
extern void BaseInit(void); extern void BaseInit(void);
extern void StartupXLOG(void); extern void StartupXLOG(void);
...@@ -102,24 +101,22 @@ struct typinfo ...@@ -102,24 +101,22 @@ struct typinfo
}; };
static struct typinfo Procid[] = { static struct typinfo Procid[] = {
{"bool", 16, 0, 1, F_BOOLIN, F_BOOLOUT}, {"bool", BOOLOID, 0, 1, F_BOOLIN, F_BOOLOUT},
{"bytea", 17, 0, -1, F_BYTEAIN, F_BYTEAOUT}, {"bytea", BYTEAOID, 0, -1, F_BYTEAIN, F_BYTEAOUT},
{"char", 18, 0, 1, F_CHARIN, F_CHAROUT}, {"char", CHAROID, 0, 1, F_CHARIN, F_CHAROUT},
{"name", 19, 0, NAMEDATALEN, F_NAMEIN, F_NAMEOUT}, {"name", NAMEOID, 0, NAMEDATALEN, F_NAMEIN, F_NAMEOUT},
{"dummy", 20, 0, 16, 0, 0}, {"int2", INT2OID, 0, 2, F_INT2IN, F_INT2OUT},
/* { "dt", 20, 0, 4, F_DTIN, F_DTOUT}, */ {"int2vector", INT2VECTOROID, 0, INDEX_MAX_KEYS*2, F_INT2VECTORIN, F_INT2VECTOROUT},
{"int2", 21, 0, 2, F_INT2IN, F_INT2OUT}, {"int4", INT4OID, 0, 4, F_INT4IN, F_INT4OUT},
{"int2vector", 22, 0, 16, F_INT2VECTORIN, F_INT2VECTOROUT}, {"regproc", REGPROCOID, 0, 4, F_REGPROCIN, F_REGPROCOUT},
{"int4", 23, 0, 4, F_INT4IN, F_INT4OUT}, {"text", TEXTOID, 0, -1, F_TEXTIN, F_TEXTOUT},
{"regproc", 24, 0, 4, F_REGPROCIN, F_REGPROCOUT}, {"oid", OIDOID, 0, 4, F_INT4IN, F_INT4OUT},
{"text", 25, 0, -1, F_TEXTIN, F_TEXTOUT}, {"tid", TIDOID, 0, 6, F_TIDIN, F_TIDOUT},
{"oid", 26, 0, 4, F_INT4IN, F_INT4OUT}, {"xid", XIDOID, 0, 4, F_XIDIN, F_XIDOUT},
{"tid", 27, 0, 6, F_TIDIN, F_TIDOUT}, {"cid", CIDOID, 0, 4, F_CIDIN, F_CIDOUT},
{"xid", 28, 0, 5, F_XIDIN, F_XIDOUT}, {"oidvector", 30, 0, INDEX_MAX_KEYS*4, F_OIDVECTORIN, F_OIDVECTOROUT},
{"iid", 29, 0, 1, F_CIDIN, F_CIDOUT},
{"oidvector", 30, 0, 32, F_OIDVECTORIN, F_OIDVECTOROUT},
{"smgr", 210, 0, 2, F_SMGRIN, F_SMGROUT}, {"smgr", 210, 0, 2, F_SMGRIN, F_SMGROUT},
{"_int4", 1007, 23, -1, F_ARRAY_IN, F_ARRAY_OUT}, {"_int4", 1007, INT4OID, -1, F_ARRAY_IN, F_ARRAY_OUT},
{"_aclitem", 1034, 1033, -1, F_ARRAY_IN, F_ARRAY_OUT} {"_aclitem", 1034, 1033, -1, F_ARRAY_IN, F_ARRAY_OUT}
}; };
...@@ -694,7 +691,13 @@ InsertOneValue(Oid objectid, char *value, int i) ...@@ -694,7 +691,13 @@ InsertOneValue(Oid objectid, char *value, int i)
} }
else else
{ {
typeindex = attrtypes[i]->atttypid - FIRST_TYPE_OID; for (typeindex = 0; typeindex < n_types; typeindex++)
{
if (Procid[typeindex].oid == attrtypes[i]->atttypid)
break;
}
if (typeindex >= n_types)
elog(ERROR, "can't find type OID %u", attrtypes[i]->atttypid);
if (DebugMode) if (DebugMode)
printf("Typ == NULL, typeindex = %u idx = %d\n", typeindex, i); printf("Typ == NULL, typeindex = %u idx = %d\n", typeindex, i);
values[i] = fmgr(Procid[typeindex].inproc, value, values[i] = fmgr(Procid[typeindex].inproc, value,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment