diff options
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r-- | src/backend/commands/indexcmds.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index cf4de7281d4..2b45699107c 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -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; |