On 18/08/2026 13:31, Hüseyin Demir wrote:
Hi,

v5 resolved this as a dry run rather than a hard block.  --check
--initdb reports the initdb command it would run and validates the
preconditions (correct new-binary version, empty target directory, old
cluster reachable) without creating the new cluster. v6 keeps that,
and the docs now describe it.

Thanks, appreciated.

Hmm, so without this, when you run "pg_upgrade --check ...", it checks various things:

$ bin/pg_upgrade --check -d data -b bin  -D data-new
Performing Consistency Checks
-----------------------------
Checking cluster versions                                     ok
Checking database connection settings                         ok
Checking for unsupported encodings                            ok
Checking database user is the install user                    ok
Checking for prepared transactions                            ok
Checking oldestXID and oldestMultiXid consistency             ok
Checking for contrib/isn with bigint-passing mismatch         ok
Checking logical replication slots                            ok
Checking subscription state                                   ok
Checking data type usage                                      ok
Checking for objects affected by Unicode update               ok
Checking for presence of required libraries                   ok
Checking database user is the install user                    ok
Checking for prepared transactions                            ok
Checking new cluster tablespace directories                   ok

*Clusters are compatible*

With the --initdb option, it skips all those checks:

$ bin/pg_upgrade --check -d data -b bin  -D data-new2 --initdb  -B bin
Examining old cluster settings                                ok
Constructing new cluster initdb command                       ok
The following initdb command would be run to create the new cluster:
bin/initdb -N -D data-new2 -U heikki --wal-segsize=16 --data-checksums --encoding=UTF8 --locale-provider=libc --lc-collate=en_GB.UTF-8 --lc-ctype=en_GB.UTF-8 The new cluster would be created with settings matching the old cluster. Run pg_upgrade --check afterward for the full compatibility check.

That's not good, that essentially means that --check doesn't work with the --initdb option. Some of the checks check that the new cluster is compatible with the old cluster, and assuming we run initdb correctly, there's no need to run those checks with --initdb. But we should still run all the checks we can on the old cluster.


Another little issue I noticed: Without the --new-bindir/-B option, it fails to find the binary:

$ bin/pg_upgrade --check -d data -b bin  -D data-new2 --initdb
could not find a "pg_upgrade" to execute

pg_upgrade: could not find own program executable
Failure, exiting

The new binary dir is not given, it's supposed to default to the same as the old one.

- Heikki


Reply via email to