1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Fix commit_ts test suite for systems with coarse timestamp granularity.

Noticed on a couple of Windows configurations.

Petr Jelinek, reviewed by Michael Paquier.
This commit is contained in:
Noah Misch
2014-12-15 20:56:09 -05:00
parent 733a264ddc
commit 0916eba131
3 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ INSERT INTO committs_test DEFAULT VALUES;
INSERT INTO committs_test DEFAULT VALUES;
SELECT id,
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
FROM committs_test
ORDER BY id;
@ -31,7 +31,7 @@ SELECT pg_xact_commit_timestamp('1'::xid);
ERROR: cannot retrieve commit timestamp for transaction 1
SELECT pg_xact_commit_timestamp('2'::xid);
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?
----------+----------+----------
t | t | t

View File

@ -13,7 +13,7 @@ INSERT INTO committs_test DEFAULT VALUES;
INSERT INTO committs_test DEFAULT VALUES;
SELECT id,
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
FROM committs_test
ORDER BY id;
@ -29,6 +29,6 @@ HINT: Make sure the configuration parameter "track_commit_timestamp" is set.
SELECT pg_xact_commit_timestamp('2'::xid);
ERROR: could not get commit timestamp data
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
HINT: Make sure the configuration parameter "track_commit_timestamp" is set.

View File

@ -10,7 +10,7 @@ INSERT INTO committs_test DEFAULT VALUES;
SELECT id,
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
FROM committs_test
ORDER BY id;
@ -21,4 +21,4 @@ SELECT pg_xact_commit_timestamp('0'::xid);
SELECT pg_xact_commit_timestamp('1'::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;