Commit 0916eba1 authored by Noah Misch's avatar Noah Misch

Fix commit_ts test suite for systems with coarse timestamp granularity.

Noticed on a couple of Windows configurations.

Petr Jelinek, reviewed by Michael Paquier.
parent 733a264d
...@@ -13,7 +13,7 @@ INSERT INTO committs_test DEFAULT VALUES; ...@@ -13,7 +13,7 @@ INSERT INTO committs_test DEFAULT VALUES;
INSERT INTO committs_test DEFAULT VALUES; INSERT INTO committs_test DEFAULT VALUES;
SELECT id, SELECT id,
pg_xact_commit_timestamp(xmin) >= ts, pg_xact_commit_timestamp(xmin) >= ts,
pg_xact_commit_timestamp(xmin) < now(), pg_xact_commit_timestamp(xmin) <= now(),
pg_xact_commit_timestamp(xmin) - ts < '60s' -- 60s should give a lot of reserve pg_xact_commit_timestamp(xmin) - ts < '60s' -- 60s should give a lot of reserve
FROM committs_test FROM committs_test
ORDER BY id; ORDER BY id;
...@@ -31,7 +31,7 @@ SELECT pg_xact_commit_timestamp('1'::xid); ...@@ -31,7 +31,7 @@ SELECT pg_xact_commit_timestamp('1'::xid);
ERROR: cannot retrieve commit timestamp for transaction 1 ERROR: cannot retrieve commit timestamp for transaction 1
SELECT pg_xact_commit_timestamp('2'::xid); SELECT pg_xact_commit_timestamp('2'::xid);
ERROR: cannot retrieve commit timestamp for transaction 2 ERROR: cannot retrieve commit timestamp for transaction 2
SELECT x.xid::text::bigint > 0, x.timestamp > '-infinity'::timestamptz, x.timestamp < now() FROM pg_last_committed_xact() x; SELECT x.xid::text::bigint > 0, x.timestamp > '-infinity'::timestamptz, x.timestamp <= now() FROM pg_last_committed_xact() x;
?column? | ?column? | ?column? ?column? | ?column? | ?column?
----------+----------+---------- ----------+----------+----------
t | t | t t | t | t
......
...@@ -13,7 +13,7 @@ INSERT INTO committs_test DEFAULT VALUES; ...@@ -13,7 +13,7 @@ INSERT INTO committs_test DEFAULT VALUES;
INSERT INTO committs_test DEFAULT VALUES; INSERT INTO committs_test DEFAULT VALUES;
SELECT id, SELECT id,
pg_xact_commit_timestamp(xmin) >= ts, pg_xact_commit_timestamp(xmin) >= ts,
pg_xact_commit_timestamp(xmin) < now(), pg_xact_commit_timestamp(xmin) <= now(),
pg_xact_commit_timestamp(xmin) - ts < '60s' -- 60s should give a lot of reserve pg_xact_commit_timestamp(xmin) - ts < '60s' -- 60s should give a lot of reserve
FROM committs_test FROM committs_test
ORDER BY id; ORDER BY id;
...@@ -29,6 +29,6 @@ HINT: Make sure the configuration parameter "track_commit_timestamp" is set. ...@@ -29,6 +29,6 @@ HINT: Make sure the configuration parameter "track_commit_timestamp" is set.
SELECT pg_xact_commit_timestamp('2'::xid); SELECT pg_xact_commit_timestamp('2'::xid);
ERROR: could not get commit timestamp data ERROR: could not get commit timestamp data
HINT: Make sure the configuration parameter "track_commit_timestamp" is set. HINT: Make sure the configuration parameter "track_commit_timestamp" is set.
SELECT x.xid::text::bigint > 0, x.timestamp > '-infinity'::timestamptz, x.timestamp < now() FROM pg_last_committed_xact() x; SELECT x.xid::text::bigint > 0, x.timestamp > '-infinity'::timestamptz, x.timestamp <= now() FROM pg_last_committed_xact() x;
ERROR: could not get commit timestamp data ERROR: could not get commit timestamp data
HINT: Make sure the configuration parameter "track_commit_timestamp" is set. HINT: Make sure the configuration parameter "track_commit_timestamp" is set.
...@@ -10,7 +10,7 @@ INSERT INTO committs_test DEFAULT VALUES; ...@@ -10,7 +10,7 @@ INSERT INTO committs_test DEFAULT VALUES;
SELECT id, SELECT id,
pg_xact_commit_timestamp(xmin) >= ts, pg_xact_commit_timestamp(xmin) >= ts,
pg_xact_commit_timestamp(xmin) < now(), pg_xact_commit_timestamp(xmin) <= now(),
pg_xact_commit_timestamp(xmin) - ts < '60s' -- 60s should give a lot of reserve pg_xact_commit_timestamp(xmin) - ts < '60s' -- 60s should give a lot of reserve
FROM committs_test FROM committs_test
ORDER BY id; ORDER BY id;
...@@ -21,4 +21,4 @@ SELECT pg_xact_commit_timestamp('0'::xid); ...@@ -21,4 +21,4 @@ SELECT pg_xact_commit_timestamp('0'::xid);
SELECT pg_xact_commit_timestamp('1'::xid); SELECT pg_xact_commit_timestamp('1'::xid);
SELECT pg_xact_commit_timestamp('2'::xid); SELECT pg_xact_commit_timestamp('2'::xid);
SELECT x.xid::text::bigint > 0, x.timestamp > '-infinity'::timestamptz, x.timestamp < now() FROM pg_last_committed_xact() x; SELECT x.xid::text::bigint > 0, x.timestamp > '-infinity'::timestamptz, x.timestamp <= now() FROM pg_last_committed_xact() x;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment