Skip to content

Commit 3c76069

Browse files
knizhnikkelvich
authored andcommitted
Add ALTER INDEX test
1 parent 2dac382 commit 3c76069

File tree

5 files changed

+5
-29
lines changed

5 files changed

+5
-29
lines changed

src/backend/commands/indexcmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ UpdateIndex(Oid indexRelationId, Node* whereClause)
300300

301301
heap_deform_tuple(oldTuple, RelationGetDescr(pg_index), values, isnull);
302302
values[Anum_pg_index_indpred - 1] = CStringGetTextDatum(nodeToString(whereClause));
303+
isnull[Anum_pg_index_indpred - 1] = false;
303304
newTuple = heap_form_tuple(RelationGetDescr(pg_index), values, isnull);
304305
simple_heap_update(pg_index, &oldTuple->t_self, newTuple);
305306
CatalogUpdateIndexes(pg_index, newTuple);
@@ -345,7 +346,6 @@ AlterIndex(Oid indexRelationId, IndexStmt *stmt)
345346
namespaceId = RelationGetNamespace(indexRelation);
346347

347348
indexInfo = BuildIndexInfo(indexRelation);
348-
Assert(indexInfo->ii_Predicate);
349349
Assert(!indexInfo->ii_ExclusionOps);
350350

351351
/*

src/backend/optimizer/path/indxpath.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,27 +1819,6 @@ check_index_only(RelOptInfo *rel, IndexOptInfo *index)
18191819
{
18201820
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
18211821

1822-
/*
1823-
* If the index is partial, we won't consider the clauses that are
1824-
* implied by the index predicate (those are not needed at runtime).
1825-
*/
1826-
if (index->indpred != NIL)
1827-
{
1828-
bool implied = false;
1829-
List *clauses = NIL;
1830-
1831-
/* need a list for the 'implied_by' call */
1832-
clauses = lappend(clauses, (Node *) rinfo->clause);
1833-
1834-
implied = predicate_implied_by(clauses, index->indpred);
1835-
1836-
/* we generally don't free memory, but well ... */
1837-
list_free(clauses);
1838-
1839-
/* if the clause is implied by index predicate, skip it */
1840-
if (implied)
1841-
continue;
1842-
}
18431822
pull_varattnos((Node *) rinfo->clause, rel->relid, &attrs_used);
18441823
}
18451824

src/test/regress/expected/aggregates.out

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,6 @@ explain (costs off)
780780
-> Index Only Scan Backward using minmaxtest2i on minmaxtest2
781781
Index Cond: (f1 IS NOT NULL)
782782
-> Index Only Scan using minmaxtest3i on minmaxtest3
783-
Index Cond: (f1 IS NOT NULL)
784783
InitPlan 2 (returns $1)
785784
-> Limit
786785
-> Merge Append
@@ -792,8 +791,7 @@ explain (costs off)
792791
-> Index Only Scan using minmaxtest2i on minmaxtest2 minmaxtest2_1
793792
Index Cond: (f1 IS NOT NULL)
794793
-> Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest3_1
795-
Index Cond: (f1 IS NOT NULL)
796-
(25 rows)
794+
(23 rows)
797795

798796
select min(f1), max(f1) from minmaxtest;
799797
min | max
@@ -819,7 +817,6 @@ explain (costs off)
819817
-> Index Only Scan Backward using minmaxtest2i on minmaxtest2
820818
Index Cond: (f1 IS NOT NULL)
821819
-> Index Only Scan using minmaxtest3i on minmaxtest3
822-
Index Cond: (f1 IS NOT NULL)
823820
InitPlan 2 (returns $1)
824821
-> Limit
825822
-> Merge Append
@@ -831,9 +828,8 @@ explain (costs off)
831828
-> Index Only Scan using minmaxtest2i on minmaxtest2 minmaxtest2_1
832829
Index Cond: (f1 IS NOT NULL)
833830
-> Index Only Scan Backward using minmaxtest3i on minmaxtest3 minmaxtest3_1
834-
Index Cond: (f1 IS NOT NULL)
835831
-> Result
836-
(27 rows)
832+
(25 rows)
837833

838834
select distinct min(f1), max(f1) from minmaxtest;
839835
min | max

src/test/regress/parallel_schedule

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ test: select_views portals_p2 foreign_key cluster dependency guc bitmapops combo
103103
# NB: temp.sql does a reconnect which transiently uses 2 connections,
104104
# so keep this parallel group to at most 19 tests
105105
# ----------
106-
test: plancache limit plpgsql copy2 temp domain rangefuncs prepare without_oid conversion truncate alter_table sequence polymorphism rowtypes returning largeobject with xml
106+
test: plancache limit plpgsql copy2 temp domain rangefuncs prepare without_oid conversion truncate alter_table alter_index_with sequence polymorphism rowtypes returning largeobject with xml
107107

108108
# event triggers cannot run concurrently with any test that runs DDL
109109
test: event_trigger

src/test/regress/serial_schedule

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ test: without_oid
152152
test: conversion
153153
test: truncate
154154
test: alter_table
155+
test: alter_index_with
155156
test: sequence
156157
test: polymorphism
157158
test: rowtypes

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy