mirror of
https://github.com/postgres/postgres.git
synced 2025-06-22 02:52:08 +03:00
Further changes to REINDEX SCHEMA
Ensure we reindex indexes built on Mat Views. Based on patch from Micheal Paquier Add thorough tests to check that indexes on tables, toast tables and mat views are reindexed. Simon Riggs
This commit is contained in:
@ -1867,16 +1867,16 @@ ReindexObject(const char *objectName, ReindexObjectType objectKind)
|
||||
*/
|
||||
if (objectKind == REINDEX_OBJECT_SCHEMA)
|
||||
{
|
||||
scan_keys = palloc(sizeof(ScanKeyData) * 2);
|
||||
/*
|
||||
* Return all objects in schema. We filter out
|
||||
* inappropriate objects as we walk through results.
|
||||
*/
|
||||
num_keys = 1;
|
||||
scan_keys = palloc(sizeof(ScanKeyData));
|
||||
ScanKeyInit(&scan_keys[0],
|
||||
Anum_pg_class_relnamespace,
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(objectOid));
|
||||
ScanKeyInit(&scan_keys[1],
|
||||
Anum_pg_class_relkind,
|
||||
BTEqualStrategyNumber, F_CHAREQ,
|
||||
'r');
|
||||
num_keys = 2;
|
||||
}
|
||||
else
|
||||
num_keys = 0;
|
||||
@ -1894,6 +1894,10 @@ ReindexObject(const char *objectName, ReindexObjectType objectKind)
|
||||
Form_pg_class classtuple = (Form_pg_class) GETSTRUCT(tuple);
|
||||
Oid relid = HeapTupleGetOid(tuple);
|
||||
|
||||
/*
|
||||
* Only regular tables and matviews can have indexes,
|
||||
* so filter out any other kind of object.
|
||||
*/
|
||||
if (classtuple->relkind != RELKIND_RELATION &&
|
||||
classtuple->relkind != RELKIND_MATVIEW)
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user