Skip to content

Commit e1b4135

Browse files
committed
Adjust pgcrypto's expected test results for --disable-strong-random.
These files were missed when commit a3ab7a7 added a new test query. Understandable considering these files no longer exist in HEAD. Per buildfarm member pademelon.
1 parent 5e72412 commit e1b4135

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

contrib/pgcrypto/expected/pgp-compression_1.out

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,31 @@ select pgp_sym_decrypt(
4040
ERROR: generating random data is not supported by this build
4141
DETAIL: This functionality requires a source of strong random numbers
4242
HINT: You need to rebuild PostgreSQL using --enable-strong-random
43+
-- check corner case involving an input string of 16kB, as per bug #16476.
44+
SELECT setseed(0);
45+
setseed
46+
---------
47+
48+
(1 row)
49+
50+
WITH random_string AS
51+
(
52+
-- This generates a random string of 16366 bytes. This is chosen
53+
-- as random so that it does not get compressed, and the decompression
54+
-- would work on a string with the same length as the origin, making the
55+
-- test behavior more predictible. lpad() ensures that the generated
56+
-- hexadecimal value is completed by extra zero characters if random()
57+
-- has generated a value strictly lower than 16.
58+
SELECT string_agg(decode(lpad(to_hex((random()*256)::int), 2, '0'), 'hex'), '') as bytes
59+
FROM generate_series(0, 16365)
60+
)
61+
SELECT bytes =
62+
pgp_sym_decrypt_bytea(
63+
pgp_sym_encrypt_bytea(bytes, 'key',
64+
'compress-algo=1,compress-level=1'),
65+
'key', 'expect-compress-algo=1')
66+
AS is_same
67+
FROM random_string;
68+
ERROR: generating random data is not supported by this build
69+
DETAIL: This functionality requires a source of strong random numbers
70+
HINT: You need to rebuild PostgreSQL using --enable-strong-random

0 commit comments

Comments
 (0)