# while we are here, also exercise --text-search-config and --set options
command_ok(
[
- 'initdb',
- '--no-sync',
+ 'initdb', '--no-sync',
'--text-search-config' => 'german',
'--set' => 'default_text_search_config=german',
'--waldir' => $xlogdir,
# Init a new db with group access
my $datadir_group = "$tempdir/data_group";
- command_ok(
- [ 'initdb', '-g', $datadir_group ],
+ command_ok([ 'initdb', '--allow-group-access', $datadir_group ],
'successful creation with group access');
ok(check_mode_recursive($datadir_group, 0750, 0640),
if ($ENV{with_icu} eq 'yes')
{
command_fails_like(
- [ 'initdb', '--no-sync', '--locale-provider=icu', "$tempdir/data2" ],
+ [
+ 'initdb', '--no-sync',
+ '--locale-provider' => 'icu',
+ "$tempdir/data2"
+ ],
qr/initdb: error: locale must be specified if provider is icu/,
'locale provider ICU requires --icu-locale');
command_ok(
[
'initdb', '--no-sync',
- '--locale-provider=icu', '--icu-locale=en',
+ '--locale-provider' => 'icu',
+ '--icu-locale' => 'en',
"$tempdir/data3"
],
'option --icu-locale');
command_like(
[
'initdb', '--no-sync',
- '-A' => 'trust',
- '--locale-provider=icu', '--locale=und',
- '--lc-collate=C', '--lc-ctype=C',
- '--lc-messages=C', '--lc-numeric=C',
- '--lc-monetary=C', '--lc-time=C',
+ '--auth' => 'trust',
+ '--locale-provider' => 'icu',
+ '--locale' => 'und',
+ '--lc-collate' => 'C',
+ '--lc-ctype' => 'C',
+ '--lc-messages' => 'C',
+ '--lc-numeric' => 'C',
+ '--lc-monetary' => 'C',
+ '--lc-time' => 'C',
"$tempdir/data4"
],
qr/^\s+default collation:\s+und\n/ms,
command_fails_like(
[
'initdb', '--no-sync',
- '--locale-provider=icu', '--icu-locale=@colNumeric=lower',
+ '--locale-provider' => 'icu',
+ '--icu-locale' => '@colNumeric=lower',
"$tempdir/dataX"
],
qr/could not open collator for locale/,
command_fails_like(
[
'initdb', '--no-sync',
- '--locale-provider=icu', '--encoding=SQL_ASCII',
- '--icu-locale=en', "$tempdir/dataX"
+ '--locale-provider' => 'icu',
+ '--encoding' => 'SQL_ASCII',
+ '--icu-locale' => 'en',
+ "$tempdir/dataX"
],
qr/error: encoding mismatch/,
'fails for encoding not supported by ICU');
command_fails_like(
[
'initdb', '--no-sync',
- '--locale-provider=icu', '--icu-locale=nonsense-nowhere',
+ '--locale-provider' => 'icu',
+ '--icu-locale' => 'nonsense-nowhere',
"$tempdir/dataX"
],
qr/error: locale "nonsense-nowhere" has unknown language "nonsense"/,
command_fails_like(
[
'initdb', '--no-sync',
- '--locale-provider=icu', '--icu-locale=@colNumeric=lower',
+ '--locale-provider' => 'icu',
+ '--icu-locale' => '@colNumeric=lower',
"$tempdir/dataX"
],
qr/could not open collator for locale "und-u-kn-lower": U_ILLEGAL_ARGUMENT_ERROR/,
else
{
command_fails(
- [ 'initdb', '--no-sync', '--locale-provider=icu', "$tempdir/data2" ],
+ [
+ 'initdb', '--no-sync',
+ '--locale-provider' => 'icu',
+ "$tempdir/data2"
+ ],
'locale provider ICU fails since no ICU support');
}
command_fails(
- [ 'initdb', '--no-sync', '--locale-provider=builtin', "$tempdir/data6" ],
+ [
+ 'initdb', '--no-sync',
+ '--locale-provider' => 'builtin',
+ "$tempdir/data6"
+ ],
'locale provider builtin fails without --locale');
command_ok(
[
'initdb', '--no-sync',
- '--locale-provider=builtin', '--locale=C',
+ '--locale-provider' => 'builtin',
+ '--locale' => 'C',
"$tempdir/data7"
],
'locale provider builtin with --locale');
command_ok(
[
'initdb', '--no-sync',
- '--locale-provider=builtin', '-E UTF-8',
- '--lc-collate=C', '--lc-ctype=C',
- '--builtin-locale=C.UTF-8', "$tempdir/data8"
+ '--locale-provider' => 'builtin',
+ '--encoding' => 'UTF-8',
+ '--lc-collate' => 'C',
+ '--lc-ctype' => 'C',
+ '--builtin-locale' => 'C.UTF-8',
+ "$tempdir/data8"
],
- 'locale provider builtin with -E UTF-8 --builtin-locale=C.UTF-8');
+ 'locale provider builtin with --encoding=UTF-8 --builtin-locale=C.UTF-8');
command_fails(
[
'initdb', '--no-sync',
- '--locale-provider=builtin', '-E SQL_ASCII',
- '--lc-collate=C', '--lc-ctype=C',
- '--builtin-locale=C.UTF-8', "$tempdir/data9"
+ '--locale-provider' => 'builtin',
+ '--encoding' => 'SQL_ASCII',
+ '--lc-collate' => 'C',
+ '--lc-ctype' => 'C',
+ '--builtin-locale' => 'C.UTF-8',
+ "$tempdir/data9"
],
'locale provider builtin with --builtin-locale=C.UTF-8 fails for SQL_ASCII'
);
command_ok(
[
'initdb', '--no-sync',
- '--locale-provider=builtin', '--lc-ctype=C',
- '--locale=C', "$tempdir/data10"
+ '--locale-provider' => 'builtin',
+ '--lc-ctype' => 'C',
+ '--locale' => 'C',
+ "$tempdir/data10"
],
'locale provider builtin with --lc-ctype');
command_fails(
[
'initdb', '--no-sync',
- '--locale-provider=builtin', '--icu-locale=en',
+ '--locale-provider' => 'builtin',
+ '--icu-locale' => 'en',
"$tempdir/dataX"
],
'fails for locale provider builtin with ICU locale');
command_fails(
[
'initdb', '--no-sync',
- '--locale-provider=builtin', '--icu-rules=""',
+ '--locale-provider' => 'builtin',
+ '--icu-rules' => '""',
"$tempdir/dataX"
],
'fails for locale provider builtin with ICU rules');
command_fails(
- [ 'initdb', '--no-sync', '--locale-provider=xyz', "$tempdir/dataX" ],
+ [
+ 'initdb', '--no-sync',
+ '--locale-provider' => 'xyz',
+ "$tempdir/dataX"
+ ],
'fails for invalid locale provider');
command_fails(
[
'initdb', '--no-sync',
- '--locale-provider=libc', '--icu-locale=en',
+ '--locale-provider' => 'libc',
+ '--icu-locale' => 'en',
"$tempdir/dataX"
],
'fails for invalid option combination');
command_fails(
- [ 'initdb', '--no-sync', '--set' => 'foo=bar', "$tempdir/dataX" ],
+ [
+ 'initdb', '--no-sync',
+ '--set' => 'foo=bar',
+ "$tempdir/dataX"
+ ],
'fails for invalid --set option');
-# Make sure multiple invocations of -c parameters are added case insensitive
+# Make sure multiple invocations of --set parameters are added case
+# insensitive.
command_ok(
[
- 'initdb', '-cwork_mem=128',
- '-cWork_Mem=256', '-cWORK_MEM=512',
+ 'initdb', '--no-sync',
+ '--set' => 'work_mem=128',
+ '--set' => 'Work_Mem=256',
+ '--set' => 'WORK_MEM=512',
"$tempdir/dataY"
],
- 'multiple -c options with different case');
+ 'multiple --set options with different case');
my $conf = slurp_file("$tempdir/dataY/postgresql.conf");
ok($conf !~ qr/^WORK_MEM = /m, "WORK_MEM should not be configured");