1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Remove pg_am.amindexnulls.

The only use we have had for amindexnulls is in determining whether an
index is safe to cluster on; but since the addition of the amclusterable
flag, that usage is pretty redundant.

In passing, clean up assorted sloppiness from the last patch that touched
pg_am.h: Natts_pg_am was wrong, and ambuildempty was not documented.
This commit is contained in:
Tom Lane
2011-01-08 16:08:05 -05:00
parent 56a57473a9
commit 7e2f906201
5 changed files with 35 additions and 76 deletions

View File

@ -436,43 +436,6 @@ check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMOD
errmsg("cannot cluster on partial index \"%s\"",
RelationGetRelationName(OldIndex))));
if (!OldIndex->rd_am->amindexnulls)
{
AttrNumber colno;
/*
* If the AM doesn't index nulls, then it's a partial index unless we
* can prove all the rows are non-null. Note we only need look at the
* first column; multicolumn-capable AMs are *required* to index nulls
* in columns after the first.
*/
colno = OldIndex->rd_index->indkey.values[0];
if (colno > 0)
{
/* ordinary user attribute */
if (!OldHeap->rd_att->attrs[colno - 1]->attnotnull)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot cluster on index \"%s\" because access method does not handle null values",
RelationGetRelationName(OldIndex)),
recheck
? errhint("You might be able to work around this by marking column \"%s\" NOT NULL, or use ALTER TABLE ... SET WITHOUT CLUSTER to remove the cluster specification from the table.",
NameStr(OldHeap->rd_att->attrs[colno - 1]->attname))
: errhint("You might be able to work around this by marking column \"%s\" NOT NULL.",
NameStr(OldHeap->rd_att->attrs[colno - 1]->attname))));
}
else if (colno < 0)
{
/* system column --- okay, always non-null */
}
else
/* index expression, lose... */
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot cluster on expressional index \"%s\" because its index access method does not handle null values",
RelationGetRelationName(OldIndex))));
}
/*
* Disallow if index is left over from a failed CREATE INDEX CONCURRENTLY;
* it might well not contain entries for every heap row, or might not even