summaryrefslogtreecommitdiff
path: root/src/include/access
diff options
context:
space:
mode:
authorMichael Paquier2020-09-02 00:08:12 +0000
committerMichael Paquier2020-09-02 00:08:12 +0000
commit1d65416661bbb0b165865a521ce038ffb61b12ad (patch)
tree2b5bb3b6cb60419afef36aeb88fb2462eee52009 /src/include/access
parent4c51a2d1e4b750bc11b8de9a85b079a14f798741 (diff)
Improve handling of dropped relations for REINDEX DATABASE/SCHEMA/SYSTEM
When multiple relations are reindexed, a scan of pg_class is done first to build the list of relations to work on. However the REINDEX logic has never checked if a relation listed still exists when beginning the work on it, causing for example sudden cache lookup failures. This commit adds safeguards against dropped relations for REINDEX, similarly to VACUUM or CLUSTER where we try to open the relation, ignoring it if it is missing. A new option is added to the REINDEX routines to control if a missed relation is OK to ignore or not. An isolation test, based on REINDEX SCHEMA, is added for the concurrent and non-concurrent cases. Author: Michael Paquier Reviewed-by: Anastasia Lubennikova Discussion: https://postgr.es/m/20200813043805.GE11663@paquier.xyz
Diffstat (limited to 'src/include/access')
-rw-r--r--src/include/access/table.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/access/table.h b/src/include/access/table.h
index cf0ef7b337b..68dc4d62c03 100644
--- a/src/include/access/table.h
+++ b/src/include/access/table.h
@@ -22,6 +22,7 @@ extern Relation table_open(Oid relationId, LOCKMODE lockmode);
extern Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode);
extern Relation table_openrv_extended(const RangeVar *relation,
LOCKMODE lockmode, bool missing_ok);
+extern Relation try_table_open(Oid relationId, LOCKMODE lockmode);
extern void table_close(Relation relation, LOCKMODE lockmode);
#endif /* TABLE_H */