v1-0002-Add-test-for-REPLICA-IDENTITY-with-a-temporal-key.patch

text/x-patch

Filename: v1-0002-Add-test-for-REPLICA-IDENTITY-with-a-temporal-key.patch
Type: text/x-patch
Part: 1
Message: Re: SQL:2011 application time

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v1-0002
Subject: Add test for REPLICA IDENTITY with a temporal key
File+
src/test/regress/expected/without_overlaps.out 4 0
src/test/regress/sql/without_overlaps.sql 4 0
From d8a17e60d6cd5f932bdc3ea0911738f675dbb187 Mon Sep 17 00:00:00 2001
From: "Paul A. Jungwirth" <pj@illuminatedcomputing.com>
Date: Tue, 26 Mar 2024 22:32:50 -0700
Subject: [PATCH v1 2/3] Add test for REPLICA IDENTITY with a temporal key

You can only use REPLICA IDENTITY USING INDEX with a unique b-tree
index. This commit just adds a test showing that you cannot use it with
a WITHOUT OVERLAPS index (which is GiST).
---
 src/test/regress/expected/without_overlaps.out | 4 ++++
 src/test/regress/sql/without_overlaps.sql      | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/test/regress/expected/without_overlaps.out b/src/test/regress/expected/without_overlaps.out
index 9c157ad65b3..d451343acfa 100644
--- a/src/test/regress/expected/without_overlaps.out
+++ b/src/test/regress/expected/without_overlaps.out
@@ -624,6 +624,10 @@ SELECT * FROM temporal3 ORDER BY id, valid_at;
 (1 row)
 
 DROP TABLE temporal3;
+-- ALTER TABLE REPLICA IDENTITY
+-- (should fail)
+ALTER TABLE temporal_rng REPLICA IDENTITY USING INDEX temporal_rng_pk;
+ERROR:  cannot use non-unique index "temporal_rng_pk" as replica identity
 --
 -- test FK dependencies
 --
diff --git a/src/test/regress/sql/without_overlaps.sql b/src/test/regress/sql/without_overlaps.sql
index ec47846594e..4d953be306f 100644
--- a/src/test/regress/sql/without_overlaps.sql
+++ b/src/test/regress/sql/without_overlaps.sql
@@ -428,6 +428,10 @@ SELECT * FROM temporal3 ORDER BY id, valid_at;
 
 DROP TABLE temporal3;
 
+-- ALTER TABLE REPLICA IDENTITY
+-- (should fail)
+ALTER TABLE temporal_rng REPLICA IDENTITY USING INDEX temporal_rng_pk;
+
 --
 -- test FK dependencies
 --
-- 
2.42.0