Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
92899992
Commit
92899992
authored
Apr 11, 2018
by
Teodor Sigaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temporary revert
5c6110c6
It discovers one more bug in CompareIndexInfo(), should be fixed first.
parent
651cb909
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
57 deletions
+13
-57
src/backend/commands/indexcmds.c
src/backend/commands/indexcmds.c
+13
-14
src/test/regress/expected/indexing.out
src/test/regress/expected/indexing.out
+0
-24
src/test/regress/sql/indexing.sql
src/test/regress/sql/indexing.sql
+0
-19
No files found.
src/backend/commands/indexcmds.c
View file @
92899992
...
...
@@ -342,7 +342,6 @@ DefineIndex(Oid relationId,
Oid
tablespaceId
;
Oid
createdConstraintId
=
InvalidOid
;
List
*
indexColNames
;
List
*
allIndexParams
;
Relation
rel
;
Relation
indexRelation
;
HeapTuple
tuple
;
...
...
@@ -379,16 +378,16 @@ DefineIndex(Oid relationId,
numberOfKeyAttributes
=
list_length
(
stmt
->
indexParams
);
/*
*
Calculate the new list of index columns including both key columns and
*
INCLUDE columns. Later we can determine which of these are key columns,
*
and which are just part of the INCLUDE list by checking the list
*
position. A list item in a position less than ii_NumIndexKeyAttrs is
*
part of the key columns, and anything equal to and over is part of the
* INCLUDE columns.
*
We append any INCLUDE columns onto the indexParams list so that we have
*
one list with all columns. Later we can determine which of these are
*
key columns, and which are just part of the INCLUDE list by checking
*
the list position. A list item in a position less than
*
ii_NumIndexKeyAttrs is part of the key columns, and anything equal to
*
and over is part of the
INCLUDE columns.
*/
allIndexParams
=
list_concat
(
list_copy
(
stmt
->
indexParams
)
,
list_copy
(
stmt
->
indexIncludingParams
)
);
numberOfAttributes
=
list_length
(
allI
ndexParams
);
stmt
->
indexParams
=
list_concat
(
stmt
->
indexParams
,
stmt
->
indexIncludingParams
);
numberOfAttributes
=
list_length
(
stmt
->
i
ndexParams
);
if
(
numberOfAttributes
<=
0
)
ereport
(
ERROR
,
...
...
@@ -545,7 +544,7 @@ DefineIndex(Oid relationId,
/*
* Choose the index column names.
*/
indexColNames
=
ChooseIndexColumnNames
(
allI
ndexParams
);
indexColNames
=
ChooseIndexColumnNames
(
stmt
->
i
ndexParams
);
/*
* Select name for index if caller didn't specify
...
...
@@ -659,7 +658,7 @@ DefineIndex(Oid relationId,
coloptions
=
(
int16
*
)
palloc
(
numberOfAttributes
*
sizeof
(
int16
));
ComputeIndexAttrs
(
indexInfo
,
typeObjectId
,
collationObjectId
,
classObjectId
,
coloptions
,
allI
ndexParams
,
coloptions
,
stmt
->
i
ndexParams
,
stmt
->
excludeOpNames
,
relationId
,
accessMethodName
,
accessMethodId
,
amcanorder
,
stmt
->
isconstraint
);
...
...
@@ -887,8 +886,8 @@ DefineIndex(Oid relationId,
memcpy
(
part_oids
,
partdesc
->
oids
,
sizeof
(
Oid
)
*
nparts
);
parentDesc
=
CreateTupleDescCopy
(
RelationGetDescr
(
rel
));
opfamOids
=
palloc
(
sizeof
(
Oid
)
*
numberOf
Key
Attributes
);
for
(
i
=
0
;
i
<
numberOf
Key
Attributes
;
i
++
)
opfamOids
=
palloc
(
sizeof
(
Oid
)
*
numberOfAttributes
);
for
(
i
=
0
;
i
<
numberOfAttributes
;
i
++
)
opfamOids
[
i
]
=
get_opclass_family
(
classObjectId
[
i
]);
heap_close
(
rel
,
NoLock
);
...
...
src/test/regress/expected/indexing.out
View file @
92899992
...
...
@@ -1313,27 +1313,3 @@ alter index idxpart2_a_idx attach partition idxpart22_a_idx;
create index on idxpart (a);
create table idxpart_another (a int, b int, primary key (a, b)) partition by range (a);
create table idxpart_another_1 partition of idxpart_another for values from (0) to (100);
-- Test that covering partitioned indexes work in various cases
create table covidxpart (a int, b int) partition by list (a);
create unique index on covidxpart (a) include (b);
create table covidxpart1 partition of covidxpart for values in (1);
create table covidxpart2 partition of covidxpart for values in (2);
insert into covidxpart values (1, 1);
insert into covidxpart values (1, 1);
ERROR: duplicate key value violates unique constraint "covidxpart1_a_b_idx"
DETAIL: Key (a)=(1) already exists.
create table covidxpart3 (b int, c int, a int);
alter table covidxpart3 drop c;
alter table covidxpart attach partition covidxpart3 for values in (3);
insert into covidxpart values (3, 1);
insert into covidxpart values (3, 1);
ERROR: duplicate key value violates unique constraint "covidxpart3_a_b_idx"
DETAIL: Key (a)=(3) already exists.
create table covidxpart4 (b int, a int);
create unique index on covidxpart4 (a) include (b);
create unique index on covidxpart4 (a);
alter table covidxpart attach partition covidxpart4 for values in (4);
insert into covidxpart values (4, 1);
insert into covidxpart values (4, 1);
ERROR: duplicate key value violates unique constraint "covidxpart4_a_b_idx"
DETAIL: Key (a)=(4) already exists.
src/test/regress/sql/indexing.sql
View file @
92899992
...
...
@@ -701,22 +701,3 @@ alter index idxpart2_a_idx attach partition idxpart22_a_idx;
create
index
on
idxpart
(
a
);
create
table
idxpart_another
(
a
int
,
b
int
,
primary
key
(
a
,
b
))
partition
by
range
(
a
);
create
table
idxpart_another_1
partition
of
idxpart_another
for
values
from
(
0
)
to
(
100
);
-- Test that covering partitioned indexes work in various cases
create
table
covidxpart
(
a
int
,
b
int
)
partition
by
list
(
a
);
create
unique
index
on
covidxpart
(
a
)
include
(
b
);
create
table
covidxpart1
partition
of
covidxpart
for
values
in
(
1
);
create
table
covidxpart2
partition
of
covidxpart
for
values
in
(
2
);
insert
into
covidxpart
values
(
1
,
1
);
insert
into
covidxpart
values
(
1
,
1
);
create
table
covidxpart3
(
b
int
,
c
int
,
a
int
);
alter
table
covidxpart3
drop
c
;
alter
table
covidxpart
attach
partition
covidxpart3
for
values
in
(
3
);
insert
into
covidxpart
values
(
3
,
1
);
insert
into
covidxpart
values
(
3
,
1
);
create
table
covidxpart4
(
b
int
,
a
int
);
create
unique
index
on
covidxpart4
(
a
)
include
(
b
);
create
unique
index
on
covidxpart4
(
a
);
alter
table
covidxpart
attach
partition
covidxpart4
for
values
in
(
4
);
insert
into
covidxpart
values
(
4
,
1
);
insert
into
covidxpart
values
(
4
,
1
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment