Skip to content

Commit 663c650

Browse files
committed
Add ALTER INDEX test
1 parent d181ab6 commit 663c650

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
@@ -295,6 +295,7 @@ UpdateIndex(Oid indexRelationId, Node* whereClause)
295295

296296
heap_deform_tuple(oldTuple, RelationGetDescr(pg_index), values, isnull);
297297
values[Anum_pg_index_indpred - 1] = CStringGetTextDatum(nodeToString(whereClause));
298+
isnull[Anum_pg_index_indpred - 1] = false;
298299
newTuple = heap_form_tuple(RelationGetDescr(pg_index), values, isnull);
299300
simple_heap_update(pg_index, &oldTuple->t_self, newTuple);
300301
CatalogUpdateIndexes(pg_index, newTuple);
@@ -340,7 +341,6 @@ AlterIndex(Oid indexRelationId, IndexStmt *stmt)
340341
namespaceId = RelationGetNamespace(indexRelation);
341342

342343
indexInfo = BuildIndexInfo(indexRelation);
343-
Assert(indexInfo->ii_Predicate);
344344
Assert(!indexInfo->ii_ExclusionOps);
345345

346346
/*

src/backend/optimizer/path/indxpath.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,27 +1829,6 @@ check_index_only(RelOptInfo *rel, IndexOptInfo *index, List *clauses)
18291829
{
18301830
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
18311831

1832-
/*
1833-
* If the index is partial, we won't consider the clauses that are
1834-
* implied by the index predicate (those are not needed at runtime).
1835-
*/
1836-
if (index->indpred != NIL)
1837-
{
1838-
bool implied = false;
1839-
List *clauses = NIL;
1840-
1841-
/* need a list for the 'implied_by' call */
1842-
clauses = lappend(clauses, (Node *) rinfo->clause);
1843-
1844-
implied = predicate_implied_by(clauses, index->indpred);
1845-
1846-
/* we generally don't free memory, but well ... */
1847-
list_free(clauses);
1848-
1849-
/* if the clause is implied by index predicate, skip it */
1850-
if (implied)
1851-
continue;
1852-
}
18531832
pull_varattnos((Node *) rinfo->clause, rel->relid, &attrs_used);
18541833
}
18551834

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