You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2025/03/04 10:21:04 UTC
(cloudberry) 02/07: ao/co: Add smoke test for partial unique indexes
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 84070273ad655afd932c6ec48b157c0ab1afe5c7
Author: Soumyadeep Chakraborty <so...@gmail.com>
AuthorDate: Mon Nov 21 09:30:18 2022 -0800
ao/co: Add smoke test for partial unique indexes
We don't have to do anything special for partial indexes. Keys not
satisfying the partial index predicate are never inserted into the
index, and hence there are no uniqueness checks triggered (see
ExecInsertIndexTuples()). Also during partial unique index builds, keys
that don't satisfy the partial index predicate are never inserted into
the index (see *_index_build_range_scan()).
Add smoke tests all the same:
* For added coverage
* For illustrative purposes
---
src/backend/access/appendonly/README.md | 7 +++++++
src/test/regress/input/uao_dml/ao_unique_index_build.source | 1 +
src/test/regress/output/uao_dml/ao_unique_index_build.source | 1 +
3 files changed, 9 insertions(+)
diff --git a/src/backend/access/appendonly/README.md b/src/backend/access/appendonly/README.md
index c6afe8a607..ab677ad849 100644
--- a/src/backend/access/appendonly/README.md
+++ b/src/backend/access/appendonly/README.md
@@ -260,3 +260,10 @@ conflicts will still be detected. Depending on whether the concurrent
transaction committed or is still in progress, the repeatable read transaction
will raise a conflict or enter into xwait respectively. This behavior is table
AM agnostic.
+
+Partial unique indexes: We don't have to do anything special for partial indexes.
+Keys not satisfying the partial index predicate are never inserted into the
+index, and hence there are no uniqueness checks triggered (see
+ExecInsertIndexTuples()). Also during partial unique index builds, keys that
+don't satisfy the partial index predicate are never inserted into the index
+(see *_index_build_range_scan()).
diff --git a/src/test/regress/input/uao_dml/ao_unique_index_build.source b/src/test/regress/input/uao_dml/ao_unique_index_build.source
index 30ee292aa0..96c0f96df0 100644
--- a/src/test/regress/input/uao_dml/ao_unique_index_build.source
+++ b/src/test/regress/input/uao_dml/ao_unique_index_build.source
@@ -81,6 +81,7 @@ SELECT * FROM unique_index_build_@amname@ WHERE i = 6;
DROP TABLE unique_index_build_@amname@;
+RESET gp_appendonly_enable_unique_index;
RESET default_table_access_method;
RESET enable_seqscan;
RESET optimizer;
diff --git a/src/test/regress/output/uao_dml/ao_unique_index_build.source b/src/test/regress/output/uao_dml/ao_unique_index_build.source
index 734d4903c0..add4e237aa 100644
--- a/src/test/regress/output/uao_dml/ao_unique_index_build.source
+++ b/src/test/regress/output/uao_dml/ao_unique_index_build.source
@@ -147,6 +147,7 @@ SELECT * FROM unique_index_build_@amname@ WHERE i = 6;
(3 rows)
DROP TABLE unique_index_build_@amname@;
+RESET gp_appendonly_enable_unique_index;
RESET default_table_access_method;
RESET enable_seqscan;
RESET optimizer;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org