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

Commit cd82e5c

Browse files
committed
Fix locale-dependent test case.
psql parses the interval argument of \watch with locale-dependent strtod(). In commit 00beecf I added a test case that exercises a fractional interval, but I hard-coded 0.01 which doesn't work in locales where the radix point isn't ".". We don't want to change this longstanding parsing behavior, so fix the test case to generate a suitably locale-aware spelling. Report and patch by Alexander Korotkov. Discussion: https://postgr.es/m/CAPpHfdv+10Uk6FWjsh3+ju7kHYr76LaRXbYayXmrM7FBU-=Hgg@mail.gmail.com
1 parent 21d7c05 commit cd82e5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/bin/psql/t/001_basic.pl

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

44
use strict;
55
use warnings;
6+
use locale;
67

78
use PostgreSQL::Test::Cluster;
89
use PostgreSQL::Test::Utils;
@@ -351,9 +352,10 @@ sub psql_fails_like
351352
);
352353

353354
# Check \watch
355+
# Note: the interval value is parsed with locale-aware strtod()
354356
psql_like(
355357
$node,
356-
'SELECT 1 \watch c=3 i=0.01',
358+
sprintf('SELECT 1 \watch c=3 i=%g', 0.01),
357359
qr/1\n1\n1/,
358360
'\watch with 3 iterations');
359361

0 commit comments

Comments
 (0)