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

Commitf6a54b8

Browse files
committed
Disallow CLUSTER using an invalid index (that is, one left over from a failed
CREATE INDEX CONCURRENTLY). Such an index might not have entries for everyheap row and thus clustering with it would result in silent data loss.The scenario requires a pretty foolish DBA, but still ...
1 parent34b44c3 commitf6a54b8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎src/backend/commands/cluster.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.163 2007/09/10 21:59:37 alvherre Exp $
14+
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.164 2007/09/29 18:05:20 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -421,6 +421,20 @@ check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck)
421421
RelationGetRelationName(OldIndex))));
422422
}
423423

424+
/*
425+
* Disallow if index is left over from a failed CREATE INDEX CONCURRENTLY;
426+
* it might well not contain entries for every heap row, or might not even
427+
* be internally consistent. (But note that we don't check indcheckxmin;
428+
* the worst consequence of following broken HOT chains would be that we
429+
* might put recently-dead tuples out-of-order in the new table, and there
430+
* is little harm in that.)
431+
*/
432+
if (!OldIndex->rd_index->indisvalid)
433+
ereport(ERROR,
434+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
435+
errmsg("cannot cluster on invalid index \"%s\"",
436+
RelationGetRelationName(OldIndex))));
437+
424438
/*
425439
* Disallow clustering system relations. This will definitely NOT work
426440
* for shared relations (we have no way to update pg_class rows in other

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp