Add test for REPLICA IDENTITY with a temporal key
authorPeter Eisentraut <[email protected]>
Wed, 8 May 2024 13:24:48 +0000 (15:24 +0200)
committerPeter Eisentraut <[email protected]>
Wed, 8 May 2024 13:24:48 +0000 (15:24 +0200)
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).

Author: Paul A. Jungwirth <[email protected]>
Discussion: https://www.postgresql.org/message-id/3775839b-3f0f-4c8a-ac03-a253222e6a4b%40illuminatedcomputing.com

src/test/regress/expected/without_overlaps.out
src/test/regress/sql/without_overlaps.sql

index f6fe8f0936968b5080ef45a6462538bd07f95df2..abc22d0113fda0203d942864e16fed881d7cac81 100644 (file)
@@ -448,6 +448,10 @@ SELECT * FROM tp2 ORDER BY id, valid_at;
 (1 row)
 
 DROP TABLE temporal_partitioned;
+-- 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
 --
index da2b7f19a85fa487ed2118133e91d76e97ca3570..d4ae03ae529b720b05fd54037591d373783872d2 100644 (file)
@@ -315,6 +315,10 @@ SELECT * FROM tp1 ORDER BY id, valid_at;
 SELECT * FROM tp2 ORDER BY id, valid_at;
 DROP TABLE temporal_partitioned;
 
+-- ALTER TABLE REPLICA IDENTITY
+-- (should fail)
+ALTER TABLE temporal_rng REPLICA IDENTITY USING INDEX temporal_rng_pk;
+
 --
 -- test FK dependencies
 --