summaryrefslogtreecommitdiffstats
path: root/src/backend/access/index
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:16:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:16:24 +0000
commit2a0f262beff32ba86bcb58f3273214e5d0517c09 (patch)
tree24c0ad10dab36bbd5c22743d3c88c4e0ccd5bc65 /src/backend/access/index
parentReleasing progress-linux version 16.2-2~progress7.99u1. (diff)
downloadpostgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.tar.xz
postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.zip
Merging upstream version 16.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/backend/access/index/genam.c6
-rw-r--r--src/backend/access/index/indexam.c17
2 files changed, 15 insertions, 8 deletions
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index 722927a..709b264 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -653,8 +653,10 @@ systable_beginscan_ordered(Relation heapRelation,
/* REINDEX can probably be a hard error here ... */
if (ReindexIsProcessingIndex(RelationGetRelid(indexRelation)))
- elog(ERROR, "cannot do ordered scan on index \"%s\", because it is being reindexed",
- RelationGetRelationName(indexRelation));
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot access index \"%s\" while it is being reindexed",
+ RelationGetRelationName(indexRelation))));
/* ... but we only throw a warning about violating IgnoreSystemIndexes */
if (IgnoreSystemIndexes)
elog(WARNING, "using index \"%s\" despite IgnoreSystemIndexes",
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index 7735ed7..715e91e 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -70,18 +70,23 @@
* Note: the ReindexIsProcessingIndex() check in RELATION_CHECKS is there
* to check that we don't try to scan or do retail insertions into an index
* that is currently being rebuilt or pending rebuild. This helps to catch
- * things that don't work when reindexing system catalogs. The assertion
+ * things that don't work when reindexing system catalogs, as well as prevent
+ * user errors like index expressions that access their own tables. The check
* doesn't prevent the actual rebuild because we don't use RELATION_CHECKS
* when calling the index AM's ambuild routine, and there is no reason for
* ambuild to call its subsidiary routines through this file.
* ----------------------------------------------------------------
*/
#define RELATION_CHECKS \
-( \
- AssertMacro(RelationIsValid(indexRelation)), \
- AssertMacro(PointerIsValid(indexRelation->rd_indam)), \
- AssertMacro(!ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) \
-)
+do { \
+ Assert(RelationIsValid(indexRelation)); \
+ Assert(PointerIsValid(indexRelation->rd_indam)); \
+ if (unlikely(ReindexIsProcessingIndex(RelationGetRelid(indexRelation)))) \
+ ereport(ERROR, \
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
+ errmsg("cannot access index \"%s\" while it is being reindexed", \
+ RelationGetRelationName(indexRelation)))); \
+} while(0)
#define SCAN_CHECKS \
( \