diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-01-18 15:04:35 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-01-18 15:04:35 +0900 |
commit | 1cf2dba84b189ef08df7b029ca5f99d85b6ce7aa (patch) | |
tree | ae3c5556c2f533466a777c87122cc6269169e69a /src/include/access/genam.h | |
parent | f374fb4aab3efd37c4c522bce68ca96c7550e8af (diff) |
Add try_index_open(), conditional variant of index_open()
try_index_open() is able to open an index if its relkind fits, except
that it would return NULL instead of generated an error if the relation
does not exist. This new routine will be used by an upcoming patch to
make REINDEX on partitioned relations more robust when an index in a
partition tree is dropped.
Extracted from a larger patch by the same author.
Author: Fei Changhong
Discussion: https://postgr.es/m/tencent_6A52106095ACDE55333E3AD33F304C0C3909@qq.com
Backpatch-through: 14
Diffstat (limited to 'src/include/access/genam.h')
-rw-r--r-- | src/include/access/genam.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h index 134b20f1e64..f6ad7c3ba55 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -138,6 +138,7 @@ typedef struct IndexOrderByDistance #define IndexScanIsValid(scan) PointerIsValid(scan) extern Relation index_open(Oid relationId, LOCKMODE lockmode); +extern Relation try_index_open(Oid relationId, LOCKMODE lockmode); extern void index_close(Relation relation, LOCKMODE lockmode); extern bool index_insert(Relation indexRelation, |