Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6050622

Browse files
committed
Use locale-aware value for \watch in 005_timeouts.pl
Reported-by: Alexander Lakhin
1 parent 196eeb6 commit 6050622

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/test/modules/test_misc/t/005_timeouts.pl

+11-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
use strict;
55
use warnings;
6+
use locale;
7+
68
use PostgreSQL::Test::Cluster;
79
use PostgreSQL::Test::Utils;
810
use Time::HiRes qw(usleep);
@@ -35,14 +37,16 @@
3537

3638
# The following query will generate a stream of SELECT 1 queries. This is done
3739
# so to exercise transaction timeout in the presence of short queries.
40+
# Note: the interval value is parsed with locale-aware strtod()
3841
$psql_session->query_until(
39-
qr/starting_bg_psql/, q(
40-
\echo starting_bg_psql
41-
SET transaction_timeout to '10ms';
42-
BEGIN;
43-
SELECT 1 \watch 0.001
44-
\q
45-
));
42+
qr/starting_bg_psql/,
43+
sprintf(
44+
q(\echo starting_bg_psql
45+
SET transaction_timeout to '10ms';
46+
BEGIN;
47+
SELECT 1 \watch %g
48+
\q
49+
), 0.001));
4650

4751
# Wait until the backend enters the timeout injection point. Will get an error
4852
# here if anything goes wrong.

0 commit comments

Comments
 (0)