Skip to content

Commit 29556bf

Browse files
committed
Adjust createdb TAP tests to work on recent OpenBSD.
We found last February that the error-case tests added by commit 008cf04 failed on OpenBSD, because that platform doesn't really check locale names. At the time it seemed that that was only an issue for LC_CTYPE, but testing on a more recent version of OpenBSD shows that it's now equally lax about LC_COLLATE. Rather than dropping the LC_COLLATE test too, put back LC_CTYPE (reverting c4b0edb), and adjust these tests to accept the different error message that we get if setlocale() doesn't reject a bogus locale name. The point of these tests is not really what the backend does with the locale name, but to show that createdb quotes funny locale names safely; so we're not losing test reliability this way. Back-patch as appropriate. Discussion: https://postgr.es/m/231373.1610058324@sss.pgh.pa.us
1 parent f2a69e9 commit 29556bf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/bin/scripts/t/020_createdb.pl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use PostgresNode;
55
use TestLib;
6-
use Test::More tests => 19;
6+
use Test::More tests => 22;
77

88
program_help_ok('createdb');
99
program_version_ok('createdb');
@@ -31,12 +31,20 @@
3131
1,
3232
[qr/^$/],
3333
[qr/^createdb: error: "foo'; SELECT '1" is not a valid encoding name/s],
34-
'createdb with incorrect --lc-collate');
34+
'createdb with incorrect --encoding');
3535
$node->command_checks_all(
3636
[ 'createdb', '--lc-collate', "foo'; SELECT '1", 'foobar2' ],
3737
1,
3838
[qr/^$/],
3939
[
40-
qr/^createdb: error: database creation failed: ERROR: invalid locale name/s
40+
qr/^createdb: error: database creation failed: ERROR: invalid locale name|^createdb: error: database creation failed: ERROR: new collation \(foo'; SELECT '1\) is incompatible with the collation of the template database/s
4141
],
4242
'createdb with incorrect --lc-collate');
43+
$node->command_checks_all(
44+
[ 'createdb', '--lc-ctype', "foo'; SELECT '1", 'foobar2' ],
45+
1,
46+
[qr/^$/],
47+
[
48+
qr/^createdb: error: database creation failed: ERROR: invalid locale name|^createdb: error: database creation failed: ERROR: new LC_CTYPE \(foo'; SELECT '1\) is incompatible with the LC_CTYPE of the template database/s
49+
],
50+
'createdb with incorrect --lc-ctype');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy