Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita53ea46

Browse files
committed
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
1 parent602ac52 commita53ea46

File tree

4 files changed

+20
-25
lines changed

4 files changed

+20
-25
lines changed

‎src/backend/catalog/index.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.55 1998/08/26 17:12:09 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.56 1998/08/28 03:36:25 momjian Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -1267,7 +1267,6 @@ FormIndexDatum(int numberOfAttributes,
12671267
FuncIndexInfoPtrfInfo)
12681268
{
12691269
AttrNumberi;
1270-
intoffset;
12711270
boolisNull;
12721271

12731272
/* ----------------
@@ -1277,19 +1276,16 @@ FormIndexDatum(int numberOfAttributes,
12771276
* ----------------
12781277
*/
12791278

1280-
for (i=1;i <=numberOfAttributes;i++)
1279+
for (i=0;i<numberOfAttributes;i++)
12811280
{
1282-
offset=AttrNumberGetAttrOffset(i);
1283-
1284-
datum[offset]=
1285-
PointerGetDatum(GetIndexValue(heapTuple,
1286-
heapDescriptor,
1287-
offset,
1288-
attributeNumber,
1289-
fInfo,
1290-
&isNull));
1291-
1292-
nullv[offset]= (isNull) ?'n' :' ';
1281+
datum[i]=PointerGetDatum(GetIndexValue(heapTuple,
1282+
heapDescriptor,
1283+
i,
1284+
attributeNumber,
1285+
fInfo,
1286+
&isNull));
1287+
1288+
nullv[i]= (isNull) ?'n' :' ';
12931289
}
12941290
}
12951291

‎src/backend/commands/vacuum.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.76 1998/08/20 22:07:39 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.77 1998/08/28 03:36:26 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1143,16 +1143,14 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
11431143
{
11441144
for (i=0,idcur=Idesc;i<nindices;i++,idcur++)
11451145
{
1146-
FormIndexDatum(
1147-
idcur->natts,
1148-
(AttrNumber*)&(idcur->tform->indkey[0]),
1146+
FormIndexDatum(idcur->natts,
1147+
(AttrNumber*)&(idcur->tform->indkey[0]),
11491148
newtup,
11501149
tupdesc,
11511150
idatum,
11521151
inulls,
11531152
idcur->finfoP);
1154-
iresult=index_insert(
1155-
Irel[i],
1153+
iresult=index_insert(Irel[i],
11561154
idatum,
11571155
inulls,
11581156
&(newtup->t_ctid),

‎src/backend/utils/cache/relcache.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.47 1998/08/19 02:03:13 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.48 1998/08/2803:36:28 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1982,10 +1982,11 @@ init_irels(void)
19821982
#defineSMD(i)strat[0].strategyMapData[i].entry[0]
19831983

19841984
/* have to reinit the function pointers in the strategy maps */
1985-
for (i=0;i<am->amstrategies;i++)
1985+
for (i=0;i<am->amstrategies*relform->relnatts;i++) {
19861986
fmgr_info(SMD(i).sk_procedure,
19871987
&(SMD(i).sk_func));
1988-
SMD(i).sk_nargs=SMD(i).sk_func.fn_nargs;
1988+
SMD(i).sk_nargs=SMD(i).sk_func.fn_nargs;
1989+
}
19891990

19901991

19911992
/*

‎src/bin/psql/psqlHelp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.50 1998/08/25 21:36:58 scrappy Exp $
8+
* $Id: psqlHelp.h,v 1.51 1998/08/28 03:36:31 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -353,7 +353,7 @@ set R_PLANS TO 'ON'| 'OFF'"},
353353
"update tuples",
354354
"\
355355
\tUPDATE class_name SET attr1 = expr1, ...attrN = exprN\n\
356-
\t[FROM from_clause]\n\
356+
\t[FROM from_clause]\n\
357357
\t[WHERE qual];"},
358358
{"vacuum",
359359
"vacuum the database, i.e. cleans out deleted records, updates statistics",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp