aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2023-07-04 14:31:57 +0200
committerPeter Eisentraut <peter@eisentraut.org>2023-07-04 14:31:57 +0200
commit657f5f223e8fd9aa12d8d9fc473faecc267b9b7a (patch)
tree14e8d6ed4e9be2b368b584c007ce2defce953fc0 /src
parent625d5b3ca0968c1d8c080d5210f7209184c0d134 (diff)
downloadpostgresql-657f5f223e8fd9aa12d8d9fc473faecc267b9b7a.tar.gz
postgresql-657f5f223e8fd9aa12d8d9fc473faecc267b9b7a.zip
Remove incidental md5() function uses from several tests
This removes md5() function calls from these test suites: - bloom - test_decoding - isolation - recovery - subscription This covers all remaining test suites where md5() calls were just used to generate some random data and can be replaced by appropriately adapted sha256() calls. This will eventually allow these tests to pass in OpenSSL FIPS mode (which does not allow MD5 use). See also 208bf364a9. Unlike for the main regression tests, I didn't write a fipshash() wrapper here, because that would have been too repetitive and wouldn't really save much here. In some cases it was easier to remove one layer of indirection by changing column types from text to bytea. Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://www.postgresql.org/message-id/flat/f9b480b5-e473-d2d1-223a-4b9db30a229a@eisentraut.org
Diffstat (limited to 'src')
-rw-r--r--src/test/isolation/specs/insert-conflict-specconflict.spec2
-rw-r--r--src/test/recovery/t/015_promotion_pages.pl4
-rw-r--r--src/test/recovery/t/026_overwrite_contrecord.pl2
-rw-r--r--src/test/subscription/t/008_diff_schema.pl4
-rw-r--r--src/test/subscription/t/015_stream.pl16
-rw-r--r--src/test/subscription/t/016_stream_subxact.pl24
-rw-r--r--src/test/subscription/t/017_stream_ddl.pl18
-rw-r--r--src/test/subscription/t/018_stream_subxact_abort.pl34
-rw-r--r--src/test/subscription/t/019_stream_subxact_ddl_abort.pl14
-rw-r--r--src/test/subscription/t/022_twophase_cascade.pl14
-rw-r--r--src/test/subscription/t/023_twophase_stream.pl24
-rw-r--r--src/test/subscription/t/029_on_error.pl8
12 files changed, 82 insertions, 82 deletions
diff --git a/src/test/isolation/specs/insert-conflict-specconflict.spec b/src/test/isolation/specs/insert-conflict-specconflict.spec
index 0d55a015b6e..66748208672 100644
--- a/src/test/isolation/specs/insert-conflict-specconflict.spec
+++ b/src/test/isolation/specs/insert-conflict-specconflict.spec
@@ -31,7 +31,7 @@ setup
RETURN $1;
END;$$;
- CREATE OR REPLACE FUNCTION ctoast_large_val() RETURNS TEXT LANGUAGE SQL AS 'select array_agg(md5(g::text))::text from generate_series(1, 256) g';
+ CREATE OR REPLACE FUNCTION ctoast_large_val() RETURNS text LANGUAGE SQL AS $$ select string_agg(encode(sha256(g::text::bytea),'hex'), '')::text from generate_series(1, 133) g $$;
CREATE TABLE upserttest(key text, data text);
diff --git a/src/test/recovery/t/015_promotion_pages.pl b/src/test/recovery/t/015_promotion_pages.pl
index 271c93aa8b4..beeb9dfddf7 100644
--- a/src/test/recovery/t/015_promotion_pages.pl
+++ b/src/test/recovery/t/015_promotion_pages.pl
@@ -54,9 +54,9 @@ $bravo->safe_psql('postgres', 'checkpoint');
# Now just use a dummy table and run some operations to move minRecoveryPoint
# beyond the previous vacuum.
-$alpha->safe_psql('postgres', 'create table test2 (a int, b text)');
+$alpha->safe_psql('postgres', 'create table test2 (a int, b bytea)');
$alpha->safe_psql('postgres',
- 'insert into test2 select generate_series(1,10000), md5(random()::text)');
+ q{insert into test2 select generate_series(1,10000), sha256(random()::text::bytea)});
$alpha->safe_psql('postgres', 'truncate test2');
# Wait again for all records to be replayed.
diff --git a/src/test/recovery/t/026_overwrite_contrecord.pl b/src/test/recovery/t/026_overwrite_contrecord.pl
index fad1811ca8d..6807a97f26d 100644
--- a/src/test/recovery/t/026_overwrite_contrecord.pl
+++ b/src/test/recovery/t/026_overwrite_contrecord.pl
@@ -39,7 +39,7 @@ DECLARE
BEGIN
LOOP
INSERT into filler
- select g, repeat(md5(g::text), (random() * 60 + 1)::int)
+ select g, repeat(encode(sha256(g::text::bytea), 'hex'), (random() * 15 + 1)::int)
from generate_series(1, 10) g;
remain := wal_segsize - (pg_current_wal_insert_lsn() - '0/0') % wal_segsize;
diff --git a/src/test/subscription/t/008_diff_schema.pl b/src/test/subscription/t/008_diff_schema.pl
index 67db1ebd3cd..c6e41b65b9f 100644
--- a/src/test/subscription/t/008_diff_schema.pl
+++ b/src/test/subscription/t/008_diff_schema.pl
@@ -48,7 +48,7 @@ is($result, qq(2|2|2), 'check initial data was copied to subscriber');
# Update the rows on the publisher and check the additional columns on
# subscriber didn't change
-$node_publisher->safe_psql('postgres', "UPDATE test_tab SET b = md5(b)");
+$node_publisher->safe_psql('postgres', "UPDATE test_tab SET b = encode(sha256(b::bytea), 'hex')");
$node_publisher->wait_for_catchup('tap_sub');
@@ -65,7 +65,7 @@ $node_subscriber->safe_psql('postgres',
"UPDATE test_tab SET c = 'epoch'::timestamptz + 987654321 * interval '1s'"
);
$node_publisher->safe_psql('postgres',
- "UPDATE test_tab SET b = md5(a::text)");
+ "UPDATE test_tab SET b = encode(sha256(a::text::bytea), 'hex')");
$node_publisher->wait_for_catchup('tap_sub');
diff --git a/src/test/subscription/t/015_stream.pl b/src/test/subscription/t/015_stream.pl
index 5c00711ef2d..b450a78adf7 100644
--- a/src/test/subscription/t/015_stream.pl
+++ b/src/test/subscription/t/015_stream.pl
@@ -38,15 +38,15 @@ sub test_streaming
$h->query_safe(
q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5000) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5000) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
});
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(5001, 9999) s(i);
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(5001, 9999) s(i);
DELETE FROM test_tab WHERE a > 5000;
COMMIT;
});
@@ -76,8 +76,8 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(5001, 10000) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(5001, 10000) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
COMMIT;
});
@@ -104,7 +104,7 @@ sub test_streaming
$offset = -s $node_subscriber->logfile;
$node_publisher->safe_psql('postgres',
- "UPDATE test_tab SET b = md5(a::text)");
+ "UPDATE test_tab SET b = sha256(a::text::bytea)");
$node_publisher->wait_for_catchup($appname);
@@ -136,7 +136,7 @@ $node_subscriber->start;
# Create some preexisting content on publisher
$node_publisher->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b varchar)");
+ "CREATE TABLE test_tab (a int primary key, b bytea)");
$node_publisher->safe_psql('postgres',
"INSERT INTO test_tab VALUES (1, 'foo'), (2, 'bar')");
@@ -144,7 +144,7 @@ $node_publisher->safe_psql('postgres', "CREATE TABLE test_tab_2 (a int)");
# Setup structure on subscriber
$node_subscriber->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
+ "CREATE TABLE test_tab (a int primary key, b bytea, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
);
$node_subscriber->safe_psql('postgres', "CREATE TABLE test_tab_2 (a int)");
diff --git a/src/test/subscription/t/016_stream_subxact.pl b/src/test/subscription/t/016_stream_subxact.pl
index d830f26e06f..838049af65c 100644
--- a/src/test/subscription/t/016_stream_subxact.pl
+++ b/src/test/subscription/t/016_stream_subxact.pl
@@ -36,24 +36,24 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
SAVEPOINT s1;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(6, 8) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(6, 8) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
SAVEPOINT s2;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(9, 11) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(9, 11) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
SAVEPOINT s3;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(12, 14) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(12, 14) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
SAVEPOINT s4;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(15, 17) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(15, 17) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
COMMIT;
});
@@ -89,13 +89,13 @@ $node_subscriber->start;
# Create some preexisting content on publisher
$node_publisher->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b varchar)");
+ "CREATE TABLE test_tab (a int primary key, b bytea)");
$node_publisher->safe_psql('postgres',
"INSERT INTO test_tab VALUES (1, 'foo'), (2, 'bar')");
# Setup structure on subscriber
$node_subscriber->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
+ "CREATE TABLE test_tab (a int primary key, b bytea, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
);
# Setup logical replication
diff --git a/src/test/subscription/t/017_stream_ddl.pl b/src/test/subscription/t/017_stream_ddl.pl
index 626676a383b..d00ede44ed1 100644
--- a/src/test/subscription/t/017_stream_ddl.pl
+++ b/src/test/subscription/t/017_stream_ddl.pl
@@ -31,7 +31,7 @@ $node_publisher->safe_psql('postgres',
# Setup structure on subscriber
$node_subscriber->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b text, c INT, d INT, e INT, f INT)"
+ "CREATE TABLE test_tab (a int primary key, b bytea, c INT, d INT, e INT, f INT)"
);
# Setup logical replication
@@ -56,10 +56,10 @@ is($result, qq(2|0|0), 'check initial data was copied to subscriber');
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
-INSERT INTO test_tab VALUES (3, md5(3::text));
+INSERT INTO test_tab VALUES (3, sha256(3::text::bytea));
ALTER TABLE test_tab ADD COLUMN c INT;
SAVEPOINT s1;
-INSERT INTO test_tab VALUES (4, md5(4::text), -4);
+INSERT INTO test_tab VALUES (4, sha256(4::text::bytea), -4);
COMMIT;
});
@@ -67,10 +67,10 @@ COMMIT;
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
-INSERT INTO test_tab SELECT i, md5(i::text), -i FROM generate_series(5, 1000) s(i);
+INSERT INTO test_tab SELECT i, sha256(i::text::bytea), -i FROM generate_series(5, 1000) s(i);
ALTER TABLE test_tab ADD COLUMN d INT;
SAVEPOINT s1;
-INSERT INTO test_tab SELECT i, md5(i::text), -i, 2*i FROM generate_series(1001, 2000) s(i);
+INSERT INTO test_tab SELECT i, sha256(i::text::bytea), -i, 2*i FROM generate_series(1001, 2000) s(i);
COMMIT;
});
@@ -78,10 +78,10 @@ COMMIT;
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
-INSERT INTO test_tab VALUES (2001, md5(2001::text), -2001, 2*2001);
+INSERT INTO test_tab VALUES (2001, sha256(2001::text::bytea), -2001, 2*2001);
ALTER TABLE test_tab ADD COLUMN e INT;
SAVEPOINT s1;
-INSERT INTO test_tab VALUES (2002, md5(2002::text), -2002, 2*2002, -3*2002);
+INSERT INTO test_tab VALUES (2002, sha256(2002::text::bytea), -2002, 2*2002, -3*2002);
COMMIT;
});
@@ -100,7 +100,7 @@ is($result, qq(2002|1999|1002|1),
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
-INSERT INTO test_tab SELECT i, md5(i::text), -i, 2*i, -3*i FROM generate_series(2003,5000) s(i);
+INSERT INTO test_tab SELECT i, sha256(i::text::bytea), -i, 2*i, -3*i FROM generate_series(2003,5000) s(i);
ALTER TABLE test_tab ADD COLUMN f INT;
COMMIT;
});
@@ -110,7 +110,7 @@ COMMIT;
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
-INSERT INTO test_tab SELECT i, md5(i::text), -i, 2*i, -3*i, 4*i FROM generate_series(5001,5005) s(i);
+INSERT INTO test_tab SELECT i, sha256(i::text::bytea), -i, 2*i, -3*i, 4*i FROM generate_series(5001,5005) s(i);
COMMIT;
});
diff --git a/src/test/subscription/t/018_stream_subxact_abort.pl b/src/test/subscription/t/018_stream_subxact_abort.pl
index 91d19ae672a..77c96011a92 100644
--- a/src/test/subscription/t/018_stream_subxact_abort.pl
+++ b/src/test/subscription/t/018_stream_subxact_abort.pl
@@ -36,21 +36,21 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab VALUES (3, md5(3::text));
+ INSERT INTO test_tab VALUES (3, sha256(3::text::bytea));
SAVEPOINT s1;
- INSERT INTO test_tab VALUES (4, md5(4::text));
+ INSERT INTO test_tab VALUES (4, sha256(4::text::bytea));
SAVEPOINT s2;
- INSERT INTO test_tab VALUES (5, md5(5::text));
+ INSERT INTO test_tab VALUES (5, sha256(5::text::bytea));
SAVEPOINT s3;
- INSERT INTO test_tab VALUES (6, md5(6::text));
+ INSERT INTO test_tab VALUES (6, sha256(6::text::bytea));
ROLLBACK TO s2;
- INSERT INTO test_tab VALUES (7, md5(7::text));
+ INSERT INTO test_tab VALUES (7, sha256(7::text::bytea));
ROLLBACK TO s1;
- INSERT INTO test_tab VALUES (8, md5(8::text));
+ INSERT INTO test_tab VALUES (8, sha256(8::text::bytea));
SAVEPOINT s4;
- INSERT INTO test_tab VALUES (9, md5(9::text));
+ INSERT INTO test_tab VALUES (9, sha256(9::text::bytea));
SAVEPOINT s5;
- INSERT INTO test_tab VALUES (10, md5(10::text));
+ INSERT INTO test_tab VALUES (10, sha256(10::text::bytea));
COMMIT;
});
@@ -73,15 +73,15 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab VALUES (11, md5(11::text));
+ INSERT INTO test_tab VALUES (11, sha256(11::text::bytea));
SAVEPOINT s1;
- INSERT INTO test_tab VALUES (12, md5(12::text));
+ INSERT INTO test_tab VALUES (12, sha256(12::text::bytea));
SAVEPOINT s2;
- INSERT INTO test_tab VALUES (13, md5(13::text));
+ INSERT INTO test_tab VALUES (13, sha256(13::text::bytea));
SAVEPOINT s3;
- INSERT INTO test_tab VALUES (14, md5(14::text));
+ INSERT INTO test_tab VALUES (14, sha256(14::text::bytea));
RELEASE s2;
- INSERT INTO test_tab VALUES (15, md5(15::text));
+ INSERT INTO test_tab VALUES (15, sha256(15::text::bytea));
ROLLBACK TO s1;
COMMIT;
});
@@ -103,11 +103,11 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab VALUES (16, md5(16::text));
+ INSERT INTO test_tab VALUES (16, sha256(16::text::bytea));
SAVEPOINT s1;
- INSERT INTO test_tab VALUES (17, md5(17::text));
+ INSERT INTO test_tab VALUES (17, sha256(17::text::bytea));
SAVEPOINT s2;
- INSERT INTO test_tab VALUES (18, md5(18::text));
+ INSERT INTO test_tab VALUES (18, sha256(18::text::bytea));
ROLLBACK;
});
@@ -140,7 +140,7 @@ $node_subscriber->start;
# Create some preexisting content on publisher
$node_publisher->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b varchar)");
+ "CREATE TABLE test_tab (a int primary key, b bytea)");
$node_publisher->safe_psql('postgres',
"INSERT INTO test_tab VALUES (1, 'foo'), (2, 'bar')");
$node_publisher->safe_psql('postgres', "CREATE TABLE test_tab_2 (a int)");
diff --git a/src/test/subscription/t/019_stream_subxact_ddl_abort.pl b/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
index d0e556c8b83..6c2a9c5bf12 100644
--- a/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
+++ b/src/test/subscription/t/019_stream_subxact_ddl_abort.pl
@@ -26,13 +26,13 @@ $node_subscriber->start;
# Create some preexisting content on publisher
$node_publisher->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b varchar)");
+ "CREATE TABLE test_tab (a int primary key, b bytea)");
$node_publisher->safe_psql('postgres',
"INSERT INTO test_tab VALUES (1, 'foo'), (2, 'bar')");
# Setup structure on subscriber
$node_subscriber->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b text, c INT, d INT, e INT)");
+ "CREATE TABLE test_tab (a int primary key, b bytea, c INT, d INT, e INT)");
# Setup logical replication
my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres';
@@ -56,19 +56,19 @@ is($result, qq(2|0), 'check initial data was copied to subscriber');
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
-INSERT INTO test_tab VALUES (3, md5(3::text));
+INSERT INTO test_tab VALUES (3, sha256(3::text::bytea));
ALTER TABLE test_tab ADD COLUMN c INT;
SAVEPOINT s1;
-INSERT INTO test_tab VALUES (4, md5(4::text), -4);
+INSERT INTO test_tab VALUES (4, sha256(4::text::bytea), -4);
ALTER TABLE test_tab ADD COLUMN d INT;
SAVEPOINT s2;
-INSERT INTO test_tab VALUES (5, md5(5::text), -5, 5*2);
+INSERT INTO test_tab VALUES (5, sha256(5::text::bytea), -5, 5*2);
ALTER TABLE test_tab ADD COLUMN e INT;
SAVEPOINT s3;
-INSERT INTO test_tab VALUES (6, md5(6::text), -6, 6*2, -6*3);
+INSERT INTO test_tab VALUES (6, sha256(6::text::bytea), -6, 6*2, -6*3);
ALTER TABLE test_tab DROP COLUMN c;
ROLLBACK TO s1;
-INSERT INTO test_tab VALUES (4, md5(4::text), 4);
+INSERT INTO test_tab VALUES (4, sha256(4::text::bytea), 4);
COMMIT;
});
diff --git a/src/test/subscription/t/022_twophase_cascade.pl b/src/test/subscription/t/022_twophase_cascade.pl
index e624ebe55c6..b37ed95c9e2 100644
--- a/src/test/subscription/t/022_twophase_cascade.pl
+++ b/src/test/subscription/t/022_twophase_cascade.pl
@@ -59,17 +59,17 @@ $node_C->safe_psql('postgres', "CREATE TABLE tab_full (a int PRIMARY KEY)");
# Create some pre-existing content on node_A (for streaming tests)
$node_A->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b varchar)");
+ "CREATE TABLE test_tab (a int primary key, b bytea)");
$node_A->safe_psql('postgres',
"INSERT INTO test_tab VALUES (1, 'foo'), (2, 'bar')");
# Create the same tables on node_B and node_C
# columns a and b are compatible with same table name on node_A
$node_B->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
+ "CREATE TABLE test_tab (a int primary key, b bytea, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
);
$node_C->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
+ "CREATE TABLE test_tab (a int primary key, b bytea, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
);
# Setup logical replication
@@ -308,8 +308,8 @@ $node_B->poll_query_until(
$node_A->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5000) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5000) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
PREPARE TRANSACTION 'test_prepared_tab';});
@@ -371,8 +371,8 @@ $node_A->safe_psql(
BEGIN;
INSERT INTO test_tab VALUES (9999, 'foobar');
SAVEPOINT sp_inner;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5000) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5000) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
ROLLBACK TO SAVEPOINT sp_inner;
PREPARE TRANSACTION 'outer';
diff --git a/src/test/subscription/t/023_twophase_stream.pl b/src/test/subscription/t/023_twophase_stream.pl
index fdcc4b359d2..fdc9e2a0f04 100644
--- a/src/test/subscription/t/023_twophase_stream.pl
+++ b/src/test/subscription/t/023_twophase_stream.pl
@@ -45,8 +45,8 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
PREPARE TRANSACTION 'test_prepared_tab';});
@@ -95,8 +95,8 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
PREPARE TRANSACTION 'test_prepared_tab';});
@@ -142,8 +142,8 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
PREPARE TRANSACTION 'test_prepared_tab';});
@@ -191,8 +191,8 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
PREPARE TRANSACTION 'test_prepared_tab';});
@@ -249,8 +249,8 @@ sub test_streaming
$node_publisher->safe_psql(
'postgres', q{
BEGIN;
- INSERT INTO test_tab SELECT i, md5(i::text) FROM generate_series(3, 5) s(i);
- UPDATE test_tab SET b = md5(b) WHERE mod(a,2) = 0;
+ INSERT INTO test_tab SELECT i, sha256(i::text::bytea) FROM generate_series(3, 5) s(i);
+ UPDATE test_tab SET b = sha256(b) WHERE mod(a,2) = 0;
DELETE FROM test_tab WHERE mod(a,3) = 0;
PREPARE TRANSACTION 'test_prepared_tab';});
@@ -316,14 +316,14 @@ $node_subscriber->start;
# Create some pre-existing content on publisher
$node_publisher->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b varchar)");
+ "CREATE TABLE test_tab (a int primary key, b bytea)");
$node_publisher->safe_psql('postgres',
"INSERT INTO test_tab VALUES (1, 'foo'), (2, 'bar')");
$node_publisher->safe_psql('postgres', "CREATE TABLE test_tab_2 (a int)");
# Setup structure on subscriber (columns a and b are compatible with same table name on publisher)
$node_subscriber->safe_psql('postgres',
- "CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
+ "CREATE TABLE test_tab (a int primary key, b bytea, c timestamptz DEFAULT now(), d bigint DEFAULT 999)"
);
$node_subscriber->safe_psql('postgres', "CREATE TABLE test_tab_2 (a int)");
diff --git a/src/test/subscription/t/029_on_error.pl b/src/test/subscription/t/029_on_error.pl
index 7d6fb66985a..fcab7386fee 100644
--- a/src/test/subscription/t/029_on_error.pl
+++ b/src/test/subscription/t/029_on_error.pl
@@ -91,13 +91,13 @@ $node_subscriber->start;
$node_publisher->safe_psql(
'postgres',
qq[
-CREATE TABLE tbl (i INT, t TEXT);
+CREATE TABLE tbl (i INT, t BYTEA);
INSERT INTO tbl VALUES (1, NULL);
]);
$node_subscriber->safe_psql(
'postgres',
qq[
-CREATE TABLE tbl (i INT PRIMARY KEY, t TEXT);
+CREATE TABLE tbl (i INT PRIMARY KEY, t BYTEA);
INSERT INTO tbl VALUES (1, NULL);
]);
@@ -163,10 +163,10 @@ $node_publisher->safe_psql(
'postgres',
qq[
BEGIN;
-INSERT INTO tbl SELECT i, md5(i::text) FROM generate_series(1, 10000) s(i);
+INSERT INTO tbl SELECT i, sha256(i::text::bytea) FROM generate_series(1, 10000) s(i);
COMMIT;
]);
-test_skip_lsn($node_publisher, $node_subscriber, "(4, md5(4::text))",
+test_skip_lsn($node_publisher, $node_subscriber, "(4, sha256(4::text::bytea))",
"4", "test skipping stream-commit");
$result = $node_subscriber->safe_psql('postgres',