Skip to content

Commit 2d7ead8

Browse files
committed
pg_stat_statements: Fix test that assumes wal_records = rows.
It's not very robust to assume that each inserted row will produce exactly one WAL record and that no other WAL records will be generated in the process, because for example a particular transaction could always be the one that has to extend clog. Because these tests are not run by 'make installcheck' but only by 'make check', it may be that in our current testing infrastructure this can't be hit, but it doesn't seem like a good idea to rely on that, since unrelated changes to the regression tests or the way write-ahead logging is done could easily cause it to start happening, and debugging such failures is a pain. Adjust the regression test to be less sensitive. Anton Melnikov, reviewed by Julien Rouhaud Discussion: http://postgr.es/m/1ccd00d9-1723-6b68-ae56-655aab00d406@inbox.ru
1 parent 7b64e4b commit 2d7ead8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

contrib/pg_stat_statements/expected/pg_stat_statements.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,18 @@ SET pg_stat_statements.track_utility = FALSE;
259259
SELECT query, calls, rows,
260260
wal_bytes > 0 as wal_bytes_generated,
261261
wal_records > 0 as wal_records_generated,
262-
wal_records = rows as wal_records_as_rows
262+
wal_records >= rows as wal_records_ge_rows
263263
FROM pg_stat_statements ORDER BY query COLLATE "C";
264-
query | calls | rows | wal_bytes_generated | wal_records_generated | wal_records_as_rows
264+
query | calls | rows | wal_bytes_generated | wal_records_generated | wal_records_ge_rows
265265
-----------------------------------------------------------+-------+------+---------------------+-----------------------+---------------------
266266
DELETE FROM pgss_test WHERE a > $1 | 1 | 1 | t | t | t
267-
DROP TABLE pgss_test | 1 | 0 | t | t | f
267+
DROP TABLE pgss_test | 1 | 0 | t | t | t
268268
INSERT INTO pgss_test VALUES(generate_series($1, $2), $3) | 1 | 10 | t | t | t
269269
SELECT pg_stat_statements_reset() | 1 | 1 | f | f | f
270270
SELECT query, calls, rows, +| 0 | 0 | f | f | t
271271
wal_bytes > $1 as wal_bytes_generated, +| | | | |
272272
wal_records > $2 as wal_records_generated, +| | | | |
273-
wal_records = rows as wal_records_as_rows +| | | | |
273+
wal_records >= rows as wal_records_ge_rows +| | | | |
274274
FROM pg_stat_statements ORDER BY query COLLATE "C" | | | | |
275275
SET pg_stat_statements.track_utility = FALSE | 1 | 0 | f | f | t
276276
UPDATE pgss_test SET b = $1 WHERE a > $2 | 1 | 3 | t | t | t

contrib/pg_stat_statements/sql/pg_stat_statements.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ SET pg_stat_statements.track_utility = FALSE;
122122
SELECT query, calls, rows,
123123
wal_bytes > 0 as wal_bytes_generated,
124124
wal_records > 0 as wal_records_generated,
125-
wal_records = rows as wal_records_as_rows
125+
wal_records >= rows as wal_records_ge_rows
126126
FROM pg_stat_statements ORDER BY query COLLATE "C";
127127

128128
--

0 commit comments

Comments
 (0)