From e6aecd7eb941d9f2c32c974b5708c6b5475694cd Mon Sep 17 00:00:00 2001
From: Melanie Plageman <melanieplageman@gmail.com>
Date: Wed, 2 Mar 2022 15:56:11 -0500
Subject: [PATCH v1 2/2] Add test for unlogged SP-GiST index

---
 src/test/regress/expected/spgist.out | 7 +++++++
 src/test/regress/sql/spgist.sql      | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/test/regress/expected/spgist.out b/src/test/regress/expected/spgist.out
index 1688e0e0a3..70ede2066b 100644
--- a/src/test/regress/expected/spgist.out
+++ b/src/test/regress/expected/spgist.out
@@ -5,6 +5,13 @@
 -- testing SP-GiST code itself.
 create table spgist_point_tbl(id int4, p point);
 create index spgist_point_idx on spgist_point_tbl using spgist(p) with (fillfactor = 75);
+-- Test creating an unlogged SP-GiST index
+-- This will exercise code to create an empty SP-GiST index in the INIT fork
+CREATE UNLOGGED TABLE spgist_point_tbl_unlogged (
+	id int4,
+	p point
+);
+CREATE INDEX spgist_point_idx_unlogged ON spgist_point_tbl_unlogged USING spgist(p);
 -- Test vacuum-root operation. It gets invoked when the root is also a leaf,
 -- i.e. the index is very small.
 insert into spgist_point_tbl (id, p)
diff --git a/src/test/regress/sql/spgist.sql b/src/test/regress/sql/spgist.sql
index 7644f344a9..ee60869b68 100644
--- a/src/test/regress/sql/spgist.sql
+++ b/src/test/regress/sql/spgist.sql
@@ -7,6 +7,14 @@
 create table spgist_point_tbl(id int4, p point);
 create index spgist_point_idx on spgist_point_tbl using spgist(p) with (fillfactor = 75);
 
+-- Test creating an unlogged SP-GiST index
+-- This will exercise code to create an empty SP-GiST index in the INIT fork
+CREATE UNLOGGED TABLE spgist_point_tbl_unlogged (
+	id int4,
+	p point
+);
+CREATE INDEX spgist_point_idx_unlogged ON spgist_point_tbl_unlogged USING spgist(p);
+
 -- Test vacuum-root operation. It gets invoked when the root is also a leaf,
 -- i.e. the index is very small.
 insert into spgist_point_tbl (id, p)
-- 
2.30.2

