# Copyright (c) 2021-2025, PostgreSQL Global Development Group
# To test successful data directory creation with an additional feature, first # try to elaborate the "successful creation" test instead of adding a test. # Successful initdb consumes much time and I/O.
use strict;
use warnings FATAL => 'all';
use Fcntl ':mode';
use File::stat qw{lstat};
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;
my $tempdir = PostgreSQL::Test::Utils::tempdir;
my $xlogdir = "$tempdir/pgxlog";
my $datadir = "$tempdir/data";
my $supports_syncfs = check_pg_config("#define HAVE_SYNCFS 1");
# Control file should tell that data checksums are enabled by default.
command_like(
[ 'pg_controldata', $datadir ],
qr/Data page checksum version:.*1/, 'checksums are enabled in control file');
# Check group access on PGDATA
SKIP:
{
skip "unix-style permissions not supported on Windows", 2 if ($windows_os || $Config::Config{osname} eq 'cygwin');
# Init a new db with group access
my $datadir_group = "$tempdir/data_group";
command_ok([ 'initdb', '--allow-group-access', $datadir_group ], 'successful creation with group access');
# Make sure multiple invocations of --set parameters are added case # insensitive.
command_ok(
[ 'initdb', '--no-sync', '--set' => 'work_mem=128', '--set' => 'Work_Mem=256', '--set' => 'WORK_MEM=512', "$tempdir/dataY"
], '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");
ok($conf !~ qr/^Work_Mem = /m, "Work_Mem should not be configured");
ok($conf =~ qr/^work_mem = 512/m, "work_mem should be in config");
# Test the no-data-checksums flag
my $datadir_nochecksums = "$tempdir/data_no_checksums";
command_ok([ 'initdb', '--no-data-checksums', $datadir_nochecksums ], 'successful creation without data checksums');
# Control file should tell that data checksums are disabled.
command_like(
[ 'pg_controldata', $datadir_nochecksums ],
qr/Data page checksum version:.*0/, 'checksums are disabled in control file');
# pg_checksums fails with checksums disabled. This is # not part of the tests included in pg_checksums to save from # the creation of an extra instance.
command_fails(
[ 'pg_checksums', '--pgdata' => $datadir_nochecksums ], "pg_checksums fails with data checksum disabled");
done_testing();
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-08-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.