index fbef3d5382d9e5bbc83b12506b93319a06f099c5..80ba25c76fbb76dae52d9cdd0296ef9e04209c9c 100644 (file)
* Open the target index relation and get an exclusive lock on it, to
* ensure that no one else is touching this particular index.
*/
- iRel = index_open(indexId, AccessExclusiveLock);
+ if ((params->options & REINDEXOPT_MISSING_OK) != 0)
+ iRel = try_index_open(indexId, AccessExclusiveLock);
+ else
+ iRel = index_open(indexId, AccessExclusiveLock);
+
+ /* if index relation is gone, leave */
+ if (!iRel)
+ {
+ /* Roll back any GUC changes */
+ AtEOXact_GUC(false, save_nestlevel);
+
+ /* Restore userid and security context */
+ SetUserIdAndSecContext(save_userid, save_sec_context);
+
+ /* Close parent heap relation, but keep locks */
+ table_close(heapRelation, NoLock);
+ return;
+ }
if (progress)
pgstat_progress_update_param(PROGRESS_CREATEIDX_ACCESS_METHOD_OID,