Re: pg_upgrade fails with a config-only datadir and no --new-bindir

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Bohyun Lee <bohyun(dot)lee(at)databricks(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade fails with a config-only datadir and no --new-bindir
Date: 2026-10-14 12:55:01
Message-ID: 2a0f3dc4-2d82-4588-adf9-c49d27f0b8da@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14/10/2026 11:04, Bohyun Lee wrote:
>> I think the ordering of checks in main() and setup() is the culprit
>> here. main() calls adjust_data_dir() first, which does this:
>>
>>>        snprintf(cmd, sizeof(cmd), "\"%s/postgres\" -D \"%s\" -C data_directory",
>>>                         cluster->bindir, cluster->pgconfig);
>>
>> to get the path to the data directory from the config. But
>> cluster->bindir isn't initialized yet.
>
> Agreed on the ordering. The main() should first call check_bin_dirs()
> to resolve the default new binary directory first and then call
> adjust_data_dir()
> to find the actual data directory when a configuration-only directory
> is specified, and then check_data_dir().

Committed, thanks for the review!

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-10-14 13:39:19 Re: pg_upgrade fails with a config-only datadir and no --new-bindir
Previous Message Tatsuya Kawata 2026-10-14 12:45:04 Re: Memoize shows only the last execution's stats for parallel workers