From ba8078561fa3ae8b2aa82abf81e1cd24206fd9e5 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddy@enterprisedb.com>
Date: Mon, 17 May 2021 12:39:28 +0530
Subject: [PATCH v1] Adjust tests for configurable TDE nonce size

Some of test outputs are dependent on the TDE nonce size, adjust
them so that make check and make check-world pass. These adjustments
are tested for nonce sizes 0, 11, 12, 13 bytes and might see more
differences with other nonce sizes.
---
 contrib/hstore/expected/hstore.out            | 10 +++----
 contrib/hstore/sql/hstore.sql                 |  4 +--
 contrib/intarray/expected/_int.out            | 16 ++++++------
 contrib/intarray/sql/_int.sql                 |  6 ++---
 contrib/ltree/expected/ltree.out              | 20 +++++++-------
 contrib/ltree/sql/ltree.sql                   |  8 +++---
 contrib/pageinspect/expected/btree.out        |  2 +-
 contrib/pageinspect/expected/hash.out         |  2 +-
 .../pageinspect/expected/oldextversions.out   |  2 +-
 contrib/pageinspect/expected/page.out         | 26 +++++++++----------
 contrib/pg_trgm/expected/pg_trgm.out          | 10 +++----
 contrib/pg_trgm/sql/pg_trgm.sql               |  4 +--
 src/test/regress/expected/insert.out          |  2 +-
 src/test/regress/expected/tsearch.out         |  4 +--
 src/test/regress/expected/vacuum.out          |  4 +--
 src/test/regress/sql/insert.sql               |  2 +-
 src/test/regress/sql/vacuum.sql               |  4 +--
 17 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/contrib/hstore/expected/hstore.out b/contrib/hstore/expected/hstore.out
index 64a3272b9c..305c7fd83f 100644
--- a/contrib/hstore/expected/hstore.out
+++ b/contrib/hstore/expected/hstore.out
@@ -1347,11 +1347,11 @@ select count(*) from testhstore where h ?& ARRAY['public','disabled'];
 drop index hidx;
 create index hidx on testhstore using gist(h gist_hstore_ops(siglen=0));
 ERROR:  value 0 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2025));
-ERROR:  value 2025 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2024));
+DETAIL:  Valid values are between "1" and "2016".
+create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2017));
+ERROR:  value 2017 out of bounds for option "siglen"
+DETAIL:  Valid values are between "1" and "2016".
+create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2016));
 set enable_seqscan=off;
 select count(*) from testhstore where h @> 'wait=>NULL';
  count 
diff --git a/contrib/hstore/sql/hstore.sql b/contrib/hstore/sql/hstore.sql
index a59db66b0a..288a1de28f 100644
--- a/contrib/hstore/sql/hstore.sql
+++ b/contrib/hstore/sql/hstore.sql
@@ -306,8 +306,8 @@ select count(*) from testhstore where h ?& ARRAY['public','disabled'];
 
 drop index hidx;
 create index hidx on testhstore using gist(h gist_hstore_ops(siglen=0));
-create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2025));
-create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2024));
+create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2017));
+create index hidx on testhstore using gist(h gist_hstore_ops(siglen=2016));
 set enable_seqscan=off;
 
 select count(*) from testhstore where h @> 'wait=>NULL';
diff --git a/contrib/intarray/expected/_int.out b/contrib/intarray/expected/_int.out
index a09d40efa1..8327caf655 100644
--- a/contrib/intarray/expected/_int.out
+++ b/contrib/intarray/expected/_int.out
@@ -550,11 +550,11 @@ SELECT count(*) from test__int WHERE a @@ '!20 & !21';
 DROP INDEX text_idx;
 CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 0));
 ERROR:  value 0 out of bounds for option "numranges"
-DETAIL:  Valid values are between "1" and "252".
+DETAIL:  Valid values are between "1" and "251".
 CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 253));
 ERROR:  value 253 out of bounds for option "numranges"
-DETAIL:  Valid values are between "1" and "252".
-CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 252));
+DETAIL:  Valid values are between "1" and "251".
+CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 251));
 SELECT count(*) from test__int WHERE a && '{23,50}';
  count 
 -------
@@ -630,11 +630,11 @@ SELECT count(*) from test__int WHERE a @@ '!20 & !21';
 DROP INDEX text_idx;
 CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 0));
 ERROR:  value 0 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 2025));
-ERROR:  value 2025 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 2024));
+DETAIL:  Valid values are between "1" and "2016".
+CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 2017));
+ERROR:  value 2017 out of bounds for option "siglen"
+DETAIL:  Valid values are between "1" and "2016".
+CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 2016));
 SELECT count(*) from test__int WHERE a && '{23,50}';
  count 
 -------
diff --git a/contrib/intarray/sql/_int.sql b/contrib/intarray/sql/_int.sql
index b26fc57e4d..c2399866d0 100644
--- a/contrib/intarray/sql/_int.sql
+++ b/contrib/intarray/sql/_int.sql
@@ -113,7 +113,7 @@ SELECT count(*) from test__int WHERE a @@ '!20 & !21';
 DROP INDEX text_idx;
 CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 0));
 CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 253));
-CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 252));
+CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 251));
 
 SELECT count(*) from test__int WHERE a && '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23|50';
@@ -130,8 +130,8 @@ SELECT count(*) from test__int WHERE a @@ '!20 & !21';
 
 DROP INDEX text_idx;
 CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 0));
-CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 2025));
-CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 2024));
+CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 2017));
+CREATE INDEX text_idx on test__int using gist (a gist__intbig_ops(siglen = 2016));
 
 SELECT count(*) from test__int WHERE a && '{23,50}';
 SELECT count(*) from test__int WHERE a @@ '23|50';
diff --git a/contrib/ltree/expected/ltree.out b/contrib/ltree/expected/ltree.out
index c6d8f3ef75..4a1c83d74f 100644
--- a/contrib/ltree/expected/ltree.out
+++ b/contrib/ltree/expected/ltree.out
@@ -7821,11 +7821,11 @@ SELECT * FROM ltreetest WHERE t ? '{23.*.1,23.*.2}' order by t asc;
 drop index tstidx;
 create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=0));
 ERROR:  value 0 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2025));
-ERROR:  value 2025 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2024));
+DETAIL:  Valid values are between "1" and "2016".
+create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2017));
+ERROR:  value 2017 out of bounds for option "siglen"
+DETAIL:  Valid values are between "1" and "2016".
+create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2016));
 SELECT count(*) FROM ltreetest WHERE t <  '12.3';
  count 
 -------
@@ -8025,11 +8025,11 @@ SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ;
 drop index _tstidx;
 create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=0));
 ERROR:  value 0 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2025));
-ERROR:  value 2025 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2024));
+DETAIL:  Valid values are between "1" and "2016".
+create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2017));
+ERROR:  value 2017 out of bounds for option "siglen"
+DETAIL:  Valid values are between "1" and "2016".
+create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2016));
 SELECT count(*) FROM _ltreetest WHERE t @> '1.1.1' ;
  count 
 -------
diff --git a/contrib/ltree/sql/ltree.sql b/contrib/ltree/sql/ltree.sql
index bf733ed17b..9e8af68eff 100644
--- a/contrib/ltree/sql/ltree.sql
+++ b/contrib/ltree/sql/ltree.sql
@@ -324,8 +324,8 @@ SELECT * FROM ltreetest WHERE t ? '{23.*.1,23.*.2}' order by t asc;
 
 drop index tstidx;
 create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=0));
-create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2025));
-create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2024));
+create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2017));
+create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2016));
 
 SELECT count(*) FROM ltreetest WHERE t <  '12.3';
 SELECT count(*) FROM ltreetest WHERE t <= '12.3';
@@ -370,8 +370,8 @@ SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ;
 
 drop index _tstidx;
 create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=0));
-create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2025));
-create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2024));
+create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2017));
+create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2016));
 
 SELECT count(*) FROM _ltreetest WHERE t @> '1.1.1' ;
 SELECT count(*) FROM _ltreetest WHERE t <@ '1.1.1' ;
diff --git a/contrib/pageinspect/expected/btree.out b/contrib/pageinspect/expected/btree.out
index c60bc88560..e43422a0c9 100644
--- a/contrib/pageinspect/expected/btree.out
+++ b/contrib/pageinspect/expected/btree.out
@@ -26,7 +26,7 @@ live_items    | 1
 dead_items    | 0
 avg_item_size | 16
 page_size     | 8192
-free_size     | 8128
+free_size     | 8112
 btpo_prev     | 0
 btpo_next     | 0
 btpo_level    | 0
diff --git a/contrib/pageinspect/expected/hash.out b/contrib/pageinspect/expected/hash.out
index bd0628d013..853ef6922d 100644
--- a/contrib/pageinspect/expected/hash.out
+++ b/contrib/pageinspect/expected/hash.out
@@ -51,7 +51,7 @@ hash_metapage_info(get_raw_page('test_hash_a_idx', 0));
 magic     | 105121344
 version   | 4
 ntuples   | 1
-bsize     | 8152
+bsize     | 8136
 bmsize    | 4096
 bmshift   | 15
 maxbucket | 3
diff --git a/contrib/pageinspect/expected/oldextversions.out b/contrib/pageinspect/expected/oldextversions.out
index 04dc7f8640..6b9c3dcb1a 100644
--- a/contrib/pageinspect/expected/oldextversions.out
+++ b/contrib/pageinspect/expected/oldextversions.out
@@ -27,7 +27,7 @@ SELECT page_checksum(get_raw_page('test1', 0), 0) IS NOT NULL AS silly_checksum_
 SELECT * FROM bt_page_stats('test1_a_idx', 1);
  blkno | type | live_items | dead_items | avg_item_size | page_size | free_size | btpo_prev | btpo_next | btpo | btpo_flags 
 -------+------+------------+------------+---------------+-----------+-----------+-----------+-----------+------+------------
-     1 | l    |          1 |          0 |            16 |      8192 |      8128 |         0 |         0 |    0 |          3
+     1 | l    |          1 |          0 |            16 |      8192 |      8112 |         0 |         0 |    0 |          3
 (1 row)
 
 SELECT * FROM bt_page_items('test1_a_idx', 1);
diff --git a/contrib/pageinspect/expected/page.out b/contrib/pageinspect/expected/page.out
index 4da28f0a1d..81eccc3443 100644
--- a/contrib/pageinspect/expected/page.out
+++ b/contrib/pageinspect/expected/page.out
@@ -69,19 +69,19 @@ SELECT tuple_data_split('test1'::regclass, t_data, t_infomask, t_infomask2, t_bi
 SELECT * FROM fsm_page_contents(get_raw_page('test1', 'fsm', 0));
  fsm_page_contents 
 -------------------
- 0: 254           +
- 1: 254           +
- 3: 254           +
- 7: 254           +
- 15: 254          +
- 31: 254          +
- 63: 254          +
- 127: 254         +
- 255: 254         +
- 511: 254         +
- 1023: 254        +
- 2047: 254        +
- 4095: 254        +
+ 0: 253           +
+ 1: 253           +
+ 3: 253           +
+ 7: 253           +
+ 15: 253          +
+ 31: 253          +
+ 63: 253          +
+ 127: 253         +
+ 255: 253         +
+ 511: 253         +
+ 1023: 253        +
+ 2047: 253        +
+ 4095: 253        +
  fp_next_slot: 0  +
  
 (1 row)
diff --git a/contrib/pg_trgm/expected/pg_trgm.out b/contrib/pg_trgm/expected/pg_trgm.out
index 20141ce7f3..567fdb9d38 100644
--- a/contrib/pg_trgm/expected/pg_trgm.out
+++ b/contrib/pg_trgm/expected/pg_trgm.out
@@ -2366,11 +2366,11 @@ select count(*) from test_trgm where t ~ '[qwerty]{2}-?[qwerty]{2}';
 drop index trgm_idx;
 create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=0));
 ERROR:  value 0 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2025));
-ERROR:  value 2025 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
-create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2024));
+DETAIL:  Valid values are between "1" and "2016".
+create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2017));
+ERROR:  value 2017 out of bounds for option "siglen"
+DETAIL:  Valid values are between "1" and "2016".
+create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2016));
 set enable_seqscan=off;
 select t,similarity(t,'qwertyu0988') as sml from test_trgm where t % 'qwertyu0988' order by sml desc, t;
       t      |   sml    
diff --git a/contrib/pg_trgm/sql/pg_trgm.sql b/contrib/pg_trgm/sql/pg_trgm.sql
index 6a9da24d5a..85354be2bc 100644
--- a/contrib/pg_trgm/sql/pg_trgm.sql
+++ b/contrib/pg_trgm/sql/pg_trgm.sql
@@ -48,8 +48,8 @@ select count(*) from test_trgm where t ~ '[qwerty]{2}-?[qwerty]{2}';
 
 drop index trgm_idx;
 create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=0));
-create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2025));
-create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2024));
+create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2017));
+create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2016));
 set enable_seqscan=off;
 
 select t,similarity(t,'qwertyu0988') as sml from test_trgm where t % 'qwertyu0988' order by sml desc, t;
diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out
index 5063a3dc22..82f6b27167 100644
--- a/src/test/regress/expected/insert.out
+++ b/src/test/regress/expected/insert.out
@@ -100,7 +100,7 @@ SELECT pg_size_pretty(pg_relation_size('large_tuple_test'::regclass, 'main'));
 INSERT INTO large_tuple_test (select 3, NULL);
 -- now this tuple won't fit on the second page, but the insert should
 -- still succeed by extending the relation
-INSERT INTO large_tuple_test (select 4, repeat('a', 8126));
+INSERT INTO large_tuple_test (select 4, repeat('a', 8062));
 DROP TABLE large_tuple_test;
 --
 -- check indirection (field/array assignment), cf bug #14265
diff --git a/src/test/regress/expected/tsearch.out b/src/test/regress/expected/tsearch.out
index 45b92a6338..ed1d33351f 100644
--- a/src/test/regress/expected/tsearch.out
+++ b/src/test/regress/expected/tsearch.out
@@ -517,10 +517,10 @@ CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(foo=1));
 ERROR:  unrecognized parameter "foo"
 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=0));
 ERROR:  value 0 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
+DETAIL:  Valid values are between "1" and "2016".
 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=2048));
 ERROR:  value 2048 out of bounds for option "siglen"
-DETAIL:  Valid values are between "1" and "2024".
+DETAIL:  Valid values are between "1" and "2016".
 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=100,foo='bar'));
 ERROR:  unrecognized parameter "foo"
 CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=100, siglen = 200));
diff --git a/src/test/regress/expected/vacuum.out b/src/test/regress/expected/vacuum.out
index 90cea6caa8..4edccf485f 100644
--- a/src/test/regress/expected/vacuum.out
+++ b/src/test/regress/expected/vacuum.out
@@ -134,7 +134,7 @@ CREATE TABLE no_index_cleanup (i INT PRIMARY KEY, t TEXT);
 CREATE INDEX no_index_cleanup_idx ON no_index_cleanup(t);
 ALTER TABLE no_index_cleanup ALTER COLUMN t SET STORAGE EXTERNAL;
 INSERT INTO no_index_cleanup(i, t) VALUES (generate_series(1,30),
-    repeat('1234567890',269));
+    repeat('1234567890',268));
 -- index cleanup option is ignored if VACUUM FULL
 VACUUM (INDEX_CLEANUP TRUE, FULL TRUE) no_index_cleanup;
 VACUUM (FULL TRUE) no_index_cleanup;
@@ -148,7 +148,7 @@ ALTER TABLE no_index_cleanup SET (vacuum_index_cleanup = true);
 VACUUM no_index_cleanup;
 -- Parameter is set for both the parent table and its toast relation.
 INSERT INTO no_index_cleanup(i, t) VALUES (generate_series(31,60),
-    repeat('1234567890',269));
+    repeat('1234567890',268));
 DELETE FROM no_index_cleanup WHERE i < 45;
 -- Only toast index is cleaned up.
 ALTER TABLE no_index_cleanup SET (vacuum_index_cleanup = false,
diff --git a/src/test/regress/sql/insert.sql b/src/test/regress/sql/insert.sql
index bfaa8a3b27..3822a755f6 100644
--- a/src/test/regress/sql/insert.sql
+++ b/src/test/regress/sql/insert.sql
@@ -55,7 +55,7 @@ INSERT INTO large_tuple_test (select 3, NULL);
 
 -- now this tuple won't fit on the second page, but the insert should
 -- still succeed by extending the relation
-INSERT INTO large_tuple_test (select 4, repeat('a', 8126));
+INSERT INTO large_tuple_test (select 4, repeat('a', 8062));
 
 DROP TABLE large_tuple_test;
 
diff --git a/src/test/regress/sql/vacuum.sql b/src/test/regress/sql/vacuum.sql
index 93fd258fc0..f44460ba53 100644
--- a/src/test/regress/sql/vacuum.sql
+++ b/src/test/regress/sql/vacuum.sql
@@ -115,7 +115,7 @@ CREATE TABLE no_index_cleanup (i INT PRIMARY KEY, t TEXT);
 CREATE INDEX no_index_cleanup_idx ON no_index_cleanup(t);
 ALTER TABLE no_index_cleanup ALTER COLUMN t SET STORAGE EXTERNAL;
 INSERT INTO no_index_cleanup(i, t) VALUES (generate_series(1,30),
-    repeat('1234567890',269));
+    repeat('1234567890',268));
 -- index cleanup option is ignored if VACUUM FULL
 VACUUM (INDEX_CLEANUP TRUE, FULL TRUE) no_index_cleanup;
 VACUUM (FULL TRUE) no_index_cleanup;
@@ -129,7 +129,7 @@ ALTER TABLE no_index_cleanup SET (vacuum_index_cleanup = true);
 VACUUM no_index_cleanup;
 -- Parameter is set for both the parent table and its toast relation.
 INSERT INTO no_index_cleanup(i, t) VALUES (generate_series(31,60),
-    repeat('1234567890',269));
+    repeat('1234567890',268));
 DELETE FROM no_index_cleanup WHERE i < 45;
 -- Only toast index is cleaned up.
 ALTER TABLE no_index_cleanup SET (vacuum_index_cleanup = false,
-- 
2.25.1

