v20251229-v4-0003-Fix-test_tde-tablespace-test-for-cross-platform-compatibility.patch
application/octet-stream
Filename: v20251229-v4-0003-Fix-test_tde-tablespace-test-for-cross-platform-compatibility.patch
Type: application/octet-stream
Part: 2
From 800bcca5ac31ada872416282acbb523ca43f464b Mon Sep 17 00:00:00 2001 From: Henson Choi <assam258@gmail.com> Date: Mon, 29 Dec 2025 12:28:39 +0900 Subject: [PATCH v4 v4 3/3] Fix test_tde tablespace test for cross-platform compatibility The test was failing on BSD and Windows due to platform-specific issues: On BSD, tablespace names must start with 'regress_' prefix to comply with regression test naming convention. On Windows, the shell command 'mkdir -p' has different syntax and the /tmp directory path is not standard. Fix by using allow_in_place_tablespaces, a developer-only option that allows creating tablespaces with empty LOCATION string. This creates the tablespace directly in pg_tblspc without requiring external directories or shell commands, making the test work consistently across all platforms. --- contrib/test_tde/expected/basic.out | 9 ++++----- contrib/test_tde/sql/basic.sql | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/contrib/test_tde/expected/basic.out b/contrib/test_tde/expected/basic.out index 9932cf43614..d5bcc732d40 100644 --- a/contrib/test_tde/expected/basic.out +++ b/contrib/test_tde/expected/basic.out @@ -158,13 +158,13 @@ DROP TABLE test_reindex; -- Test 5: ALTER TABLE SET TABLESPACE -- RelFileNumber changes, but data is copied through storage hooks -- ----------------------------------------------------------------------------- -\! mkdir -p /tmp/test_tde_tablespace -CREATE TABLESPACE test_tde_tblspc LOCATION '/tmp/test_tde_tablespace'; +SET allow_in_place_tablespaces = true; +CREATE TABLESPACE regress_tde_tblspc LOCATION ''; CREATE TABLE test_set_tablespace (id int, data text); INSERT INTO test_set_tablespace SELECT g, 'data ' || g FROM generate_series(1, 50) g; CHECKPOINT; -- Move to different tablespace - data copied through storage hooks -ALTER TABLE test_set_tablespace SET TABLESPACE test_tde_tblspc; +ALTER TABLE test_set_tablespace SET TABLESPACE regress_tde_tblspc; -- Works fine - data was re-encrypted with new RelFileNumber SELECT COUNT(*) FROM test_set_tablespace; count @@ -173,5 +173,4 @@ SELECT COUNT(*) FROM test_set_tablespace; (1 row) DROP TABLE test_set_tablespace; -DROP TABLESPACE test_tde_tblspc; -\! rm -rf /tmp/test_tde_tablespace +DROP TABLESPACE regress_tde_tblspc; diff --git a/contrib/test_tde/sql/basic.sql b/contrib/test_tde/sql/basic.sql index 9b2651afee8..e52fdea7a5b 100644 --- a/contrib/test_tde/sql/basic.sql +++ b/contrib/test_tde/sql/basic.sql @@ -128,19 +128,18 @@ DROP TABLE test_reindex; -- Test 5: ALTER TABLE SET TABLESPACE -- RelFileNumber changes, but data is copied through storage hooks -- ----------------------------------------------------------------------------- -\! mkdir -p /tmp/test_tde_tablespace -CREATE TABLESPACE test_tde_tblspc LOCATION '/tmp/test_tde_tablespace'; +SET allow_in_place_tablespaces = true; +CREATE TABLESPACE regress_tde_tblspc LOCATION ''; CREATE TABLE test_set_tablespace (id int, data text); INSERT INTO test_set_tablespace SELECT g, 'data ' || g FROM generate_series(1, 50) g; CHECKPOINT; -- Move to different tablespace - data copied through storage hooks -ALTER TABLE test_set_tablespace SET TABLESPACE test_tde_tblspc; +ALTER TABLE test_set_tablespace SET TABLESPACE regress_tde_tblspc; -- Works fine - data was re-encrypted with new RelFileNumber SELECT COUNT(*) FROM test_set_tablespace; DROP TABLE test_set_tablespace; -DROP TABLESPACE test_tde_tblspc; -\! rm -rf /tmp/test_tde_tablespace +DROP TABLESPACE regress_tde_tblspc; -- 2.50.1 (Apple Git-155)