Commit a53ea467 authored by Bruce Momjian's avatar Bruce Momjian

Hi all,

    I  don't know if this is really related to the initdb problem
    discussion (haven't followed it enough). But seems so because
    it  fixes  a  damn  problem  during  index tuple insertion on
    CREATE TABLE into pg_attribute_relid_attnum_index.

    Anyway - this bug was really hard to find. During startup the
    relcache  reads  in  some  prepared  information  about index
    strategies from a file and then  reinitializes  the  function
    pointers  inside  the  scanKey data.  But for sake it assumed
    single attribute index tuples (hasn't that changed recently).
    Thus not all the strategies scanKey entries where initialized
    properly,  resulting  in  invalid  addresses  for  the  btree
    comparision functions.

    With  the  patch  at  the  end  the  regression  tests passed
    excellent except for the sanity_check that crashed at  vacuum
    and the misc test where the select unique1 from onek2 outputs
    the two rows in different order.

Jan
parent 602ac52d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.55 1998/08/26 17:12:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.56 1998/08/28 03:36:25 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1267,7 +1267,6 @@ FormIndexDatum(int numberOfAttributes, ...@@ -1267,7 +1267,6 @@ FormIndexDatum(int numberOfAttributes,
FuncIndexInfoPtr fInfo) FuncIndexInfoPtr fInfo)
{ {
AttrNumber i; AttrNumber i;
int offset;
bool isNull; bool isNull;
/* ---------------- /* ----------------
...@@ -1277,19 +1276,16 @@ FormIndexDatum(int numberOfAttributes, ...@@ -1277,19 +1276,16 @@ FormIndexDatum(int numberOfAttributes,
* ---------------- * ----------------
*/ */
for (i = 1; i <= numberOfAttributes; i++) for (i = 0; i < numberOfAttributes; i++)
{ {
offset = AttrNumberGetAttrOffset(i); datum[i] = PointerGetDatum(GetIndexValue(heapTuple,
datum[offset] =
PointerGetDatum(GetIndexValue(heapTuple,
heapDescriptor, heapDescriptor,
offset, i,
attributeNumber, attributeNumber,
fInfo, fInfo,
&isNull)); &isNull));
nullv[offset] = (isNull) ? 'n' : ' '; nullv[i] = (isNull) ? 'n' : ' ';
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.76 1998/08/20 22:07:39 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.77 1998/08/28 03:36:26 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1143,16 +1143,14 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", ...@@ -1143,16 +1143,14 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
{ {
for (i = 0, idcur = Idesc; i < nindices; i++, idcur++) for (i = 0, idcur = Idesc; i < nindices; i++, idcur++)
{ {
FormIndexDatum( FormIndexDatum(idcur->natts,
idcur->natts,
(AttrNumber *) &(idcur->tform->indkey[0]), (AttrNumber *) &(idcur->tform->indkey[0]),
newtup, newtup,
tupdesc, tupdesc,
idatum, idatum,
inulls, inulls,
idcur->finfoP); idcur->finfoP);
iresult = index_insert( iresult = index_insert(Irel[i],
Irel[i],
idatum, idatum,
inulls, inulls,
&(newtup->t_ctid), &(newtup->t_ctid),
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.47 1998/08/19 02:03:13 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.48 1998/08/28 03:36:28 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1982,10 +1982,11 @@ init_irels(void) ...@@ -1982,10 +1982,11 @@ init_irels(void)
#define SMD(i) strat[0].strategyMapData[i].entry[0] #define SMD(i) strat[0].strategyMapData[i].entry[0]
/* have to reinit the function pointers in the strategy maps */ /* have to reinit the function pointers in the strategy maps */
for (i = 0; i < am->amstrategies; i++) for (i = 0; i < am->amstrategies * relform->relnatts; i++) {
fmgr_info(SMD(i).sk_procedure, fmgr_info(SMD(i).sk_procedure,
&(SMD(i).sk_func)); &(SMD(i).sk_func));
SMD(i).sk_nargs = SMD(i).sk_func.fn_nargs; SMD(i).sk_nargs = SMD(i).sk_func.fn_nargs;
}
/* /*
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: psqlHelp.h,v 1.50 1998/08/25 21:36:58 scrappy Exp $ * $Id: psqlHelp.h,v 1.51 1998/08/28 03:36:31 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -353,7 +353,7 @@ set R_PLANS TO 'ON'| 'OFF'"}, ...@@ -353,7 +353,7 @@ set R_PLANS TO 'ON'| 'OFF'"},
"update tuples", "update tuples",
"\ "\
\tUPDATE class_name SET attr1 = expr1, ...attrN = exprN\n\ \tUPDATE class_name SET attr1 = expr1, ...attrN = exprN\n\
\t [FROM from_clause]\n\ \t[FROM from_clause]\n\
\t[WHERE qual];"}, \t[WHERE qual];"},
{"vacuum", {"vacuum",
"vacuum the database, i.e. cleans out deleted records, updates statistics", "vacuum the database, i.e. cleans out deleted records, updates statistics",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment