2 -- Verify correct calculation of checksums
4 -- Postgres' checksum algorithm produces different answers on little-endian
5 -- and big-endian machines. The results of this test also vary depending
6 -- on the configured block size. This test has several different expected
7 -- results files to handle the following possibilities:
11 -- 8K BE checksum_1.out
13 -- In future we might provide additional expected-results files for other
14 -- block sizes, but there seems little point as long as so many other
15 -- test scripts also show false failures for non-default block sizes.
17 -- This is to label the results files with blocksize:
25 -- Apply page_checksum() to some different data patterns and block numbers
27 page_checksum(decode(repeat('01', :block_size), 'hex'), blkno) AS checksum_01,
28 page_checksum(decode(repeat('04', :block_size), 'hex'), blkno) AS checksum_04,
29 page_checksum(decode(repeat('ff', :block_size), 'hex'), blkno) AS checksum_ff,
30 page_checksum(decode(repeat('abcd', :block_size / 2), 'hex'), blkno) AS checksum_abcd,
31 page_checksum(decode(repeat('e6d6', :block_size / 2), 'hex'), blkno) AS checksum_e6d6,
32 page_checksum(decode(repeat('4a5e', :block_size / 2), 'hex'), blkno) AS checksum_4a5e
33 FROM generate_series(0, 100, 50) AS a (blkno);
34 blkno | checksum_01 | checksum_04 | checksum_ff | checksum_abcd | checksum_e6d6 | checksum_4a5e
35 -------+-------------+-------------+-------------+---------------+---------------+---------------
36 0 | 1175 | 28338 | 3612 | -30781 | -16269 | -27377
37 50 | 1225 | 28352 | 3598 | -30795 | -16251 | -27391
38 100 | 1139 | 28438 | 3648 | -30881 | -16305 | -27349