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

Commit9289999

Browse files
committed
Temporary revert5c6110c
It discovers one more bug in CompareIndexInfo(), should be fixed first.
1 parent651cb90 commit9289999

File tree

3 files changed

+13
-57
lines changed

3 files changed

+13
-57
lines changed

‎src/backend/commands/indexcmds.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ DefineIndex(Oid relationId,
342342
OidtablespaceId;
343343
OidcreatedConstraintId=InvalidOid;
344344
List*indexColNames;
345-
List*allIndexParams;
346345
Relationrel;
347346
RelationindexRelation;
348347
HeapTupletuple;
@@ -379,16 +378,16 @@ DefineIndex(Oid relationId,
379378
numberOfKeyAttributes=list_length(stmt->indexParams);
380379

381380
/*
382-
*Calculate the new list of index columns including both key columns and
383-
*INCLUDEcolumns. Later we can determine which of these are key columns,
384-
* and which are just part of the INCLUDE list by checking the list
385-
* position. A list item in a position less than ii_NumIndexKeyAttrs is
386-
* part of the key columns, and anything equal to and over is part of the
387-
* INCLUDE columns.
381+
*We append any INCLUDE columns onto the indexParams list so that we have
382+
*one list with allcolumns. Later we can determine which of these are
383+
*key columns,and which are just part of the INCLUDE list by checking
384+
*the listposition. A list item in a position less than
385+
*ii_NumIndexKeyAttrs ispart of the key columns, and anything equal to
386+
*and over is part of theINCLUDE columns.
388387
*/
389-
allIndexParams=list_concat(list_copy(stmt->indexParams),
390-
list_copy(stmt->indexIncludingParams));
391-
numberOfAttributes=list_length(allIndexParams);
388+
stmt->indexParams=list_concat(stmt->indexParams,
389+
stmt->indexIncludingParams);
390+
numberOfAttributes=list_length(stmt->indexParams);
392391

393392
if (numberOfAttributes <=0)
394393
ereport(ERROR,
@@ -545,7 +544,7 @@ DefineIndex(Oid relationId,
545544
/*
546545
* Choose the index column names.
547546
*/
548-
indexColNames=ChooseIndexColumnNames(allIndexParams);
547+
indexColNames=ChooseIndexColumnNames(stmt->indexParams);
549548

550549
/*
551550
* Select name for index if caller didn't specify
@@ -659,7 +658,7 @@ DefineIndex(Oid relationId,
659658
coloptions= (int16*)palloc(numberOfAttributes*sizeof(int16));
660659
ComputeIndexAttrs(indexInfo,
661660
typeObjectId,collationObjectId,classObjectId,
662-
coloptions,allIndexParams,
661+
coloptions,stmt->indexParams,
663662
stmt->excludeOpNames,relationId,
664663
accessMethodName,accessMethodId,
665664
amcanorder,stmt->isconstraint);
@@ -887,8 +886,8 @@ DefineIndex(Oid relationId,
887886
memcpy(part_oids,partdesc->oids,sizeof(Oid)*nparts);
888887

889888
parentDesc=CreateTupleDescCopy(RelationGetDescr(rel));
890-
opfamOids=palloc(sizeof(Oid)*numberOfKeyAttributes);
891-
for (i=0;i<numberOfKeyAttributes;i++)
889+
opfamOids=palloc(sizeof(Oid)*numberOfAttributes);
890+
for (i=0;i<numberOfAttributes;i++)
892891
opfamOids[i]=get_opclass_family(classObjectId[i]);
893892

894893
heap_close(rel,NoLock);

‎src/test/regress/expected/indexing.out

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,27 +1313,3 @@ alter index idxpart2_a_idx attach partition idxpart22_a_idx;
13131313
create index on idxpart (a);
13141314
create table idxpart_another (a int, b int, primary key (a, b)) partition by range (a);
13151315
create table idxpart_another_1 partition of idxpart_another for values from (0) to (100);
1316-
-- Test that covering partitioned indexes work in various cases
1317-
create table covidxpart (a int, b int) partition by list (a);
1318-
create unique index on covidxpart (a) include (b);
1319-
create table covidxpart1 partition of covidxpart for values in (1);
1320-
create table covidxpart2 partition of covidxpart for values in (2);
1321-
insert into covidxpart values (1, 1);
1322-
insert into covidxpart values (1, 1);
1323-
ERROR: duplicate key value violates unique constraint "covidxpart1_a_b_idx"
1324-
DETAIL: Key (a)=(1) already exists.
1325-
create table covidxpart3 (b int, c int, a int);
1326-
alter table covidxpart3 drop c;
1327-
alter table covidxpart attach partition covidxpart3 for values in (3);
1328-
insert into covidxpart values (3, 1);
1329-
insert into covidxpart values (3, 1);
1330-
ERROR: duplicate key value violates unique constraint "covidxpart3_a_b_idx"
1331-
DETAIL: Key (a)=(3) already exists.
1332-
create table covidxpart4 (b int, a int);
1333-
create unique index on covidxpart4 (a) include (b);
1334-
create unique index on covidxpart4 (a);
1335-
alter table covidxpart attach partition covidxpart4 for values in (4);
1336-
insert into covidxpart values (4, 1);
1337-
insert into covidxpart values (4, 1);
1338-
ERROR: duplicate key value violates unique constraint "covidxpart4_a_b_idx"
1339-
DETAIL: Key (a)=(4) already exists.

‎src/test/regress/sql/indexing.sql

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -701,22 +701,3 @@ alter index idxpart2_a_idx attach partition idxpart22_a_idx;
701701
createindexon idxpart (a);
702702
createtableidxpart_another (aint, bint,primary key (a, b)) partition by range (a);
703703
createtableidxpart_another_1 partition of idxpart_another forvaluesfrom (0) to (100);
704-
705-
-- Test that covering partitioned indexes work in various cases
706-
createtablecovidxpart (aint, bint) partition by list (a);
707-
createunique indexon covidxpart (a) include (b);
708-
createtablecovidxpart1 partition of covidxpart forvaluesin (1);
709-
createtablecovidxpart2 partition of covidxpart forvaluesin (2);
710-
insert into covidxpartvalues (1,1);
711-
insert into covidxpartvalues (1,1);
712-
createtablecovidxpart3 (bint, cint, aint);
713-
altertable covidxpart3 drop c;
714-
altertable covidxpart attach partition covidxpart3 forvaluesin (3);
715-
insert into covidxpartvalues (3,1);
716-
insert into covidxpartvalues (3,1);
717-
createtablecovidxpart4 (bint, aint);
718-
createunique indexon covidxpart4 (a) include (b);
719-
createunique indexon covidxpart4 (a);
720-
altertable covidxpart attach partition covidxpart4 forvaluesin (4);
721-
insert into covidxpartvalues (4,1);
722-
insert into covidxpartvalues (4,1);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp