BUG #19392: PG_UPGRADE is non-functional on Windows

Поиск
Список
Период
Сортировка
Искать

BUG #19392: PG_UPGRADE is non-functional on Windows

От:
PG Bug reporting form <noreply@postgresql.org>
Дата:
The following bug has been logged on the website:

Bug reference:      19392
Logged by:          Jeff Laing
Email address:      jeff.laing@spatialnetworx.ai
PostgreSQL version: 18.1
Operating system:   Windows 11
Description:        

After struggling with it for a while, I’ve come to the conclusion that
PG_UPGRADE is not functional on Windows.

Although there may be a permissions error still present, I can see that the
command-line construction is obviously in error.

The offending source code is in src\bin\pg_upgrade\server.c – in the 18
sources, it looks like this:

        /*
         * Use -b to disable autovacuum and logical replication launcher
         * (effective in PG17 or later for the latter).
         */
        snprintf(cmd, sizeof(cmd),
                         "\"%s/pg_ctl\" -w -l \"%s/%s\" -D \"%s\" -o \"-p %d
-b%s %s%s\" start",
                         cluster->bindir,
                         log_opts.logdir,
                         SERVER_LOG_FILE, cluster->pgconfig, cluster->port,
                         pgoptions.data,
                         cluster->pgopts ? cluster->pgopts : "",
socket_string);

This results in command-lines that look like:

        "C:/postgresql16/bin/pg_ctl" -w -l
"C:/postgresql18/data/pg_upgrade_output.d/20260204T130353.043/log/pg_upgrade_server.log"
-D "C:/postgresql16/data" -o "-p 5432 -b " start >>
"C:/postgresql18/data/pg_upgrade_output.d/20260204T130353.043/log/pg_upgrade_server_start.log"
2>&1

connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no
password supplied
could not connect to source postmaster started with the command:
"C:/postgresql16/bin/pg_ctl" -w -l
"C:/postgresql18/data/pg_upgrade_output.d/20260204T130353.043/log/pg_upgrade_server.log"
-D "C:/postgresql16/data" -o "-p 5432 -b " start
Failure, exiting

Note the quoting around the -o, -p and -b arguments.
There should perhaps be TWO double-quotes after -o or it should not be
present.
There should not be a double-quote after -b

The problem appears as far back as the 16 sources.




Re: BUG #19392: PG_UPGRADE is non-functional on Windows

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Tuesday, February 3, 2026, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      19392
Logged by:          Jeff Laing
Email address:      jeff.laing@spatialnetworx.ai
PostgreSQL version: 18.1
Operating system:   Windows 11
Description:       

After struggling with it for a while, I’ve come to the conclusion that
PG_UPGRADE is not functional on Windows.

This is a very hard to accept premise and this bug report doesn’t support it.
 

This results in command-lines that look like:

        "C:/postgresql16/bin/pg_ctl" -w -l
"C:/postgresql18/data/pg_upgrade_output.d/20260204T130353.043/log/pg_upgrade_server.log"
-D "C:/postgresql16/data" -o "-p 5432 -b " start >>
"C:/postgresql18/data/pg_upgrade_output.d/20260204T130353.043/log/pg_upgrade_server_start.log"
2>&1

connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no
password supplied
could not connect to source postmaster started with the command:
"C:/postgresql16/bin/pg_ctl" -w -l
"C:/postgresql18/data/pg_upgrade_output.d/20260204T130353.043/log/pg_upgrade_server.log"
-D "C:/postgresql16/data" -o "-p 5432 -b " start
Failure, exiting

Note the quoting around the -o, -p and -b arguments.
There should perhaps be TWO double-quotes after -o or it should not be
present.
There should not be a double-quote after -b

Showing the log files generated by the startup attempts would be helpful.  Your guess here regarding how the “-o” argument’s value behaves is incorrect, the quotes are precisely where the documentation says they should be.  They should result in something like: “…/postgres -p 5432 -b” as a subprocess of the pg_ctl command which is valid.


The problem appears as far back as the 16 sources.


It seems even more unlikely that if this were the underlying cause it would have gone undetected for two full releases.

We will need a reproducing bug report with the commands issued and logs generated.

David J.

Re: BUG #19392: PG_UPGRADE is non-functional on Windows

От:
Michael Paquier <michael@paquier.xyz>
Дата:
Вложения:
On Wed, Feb 04, 2026 at 02:29:19AM +0000, PG Bug reporting form wrote:
> connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no
> password supplied
> could not connect to source postmaster started with the command:
> "C:/postgresql16/bin/pg_ctl" -w -l
> "C:/postgresql18/data/pg_upgrade_output.d/20260204T130353.043/log/pg_upgrade_server.log"
> -D "C:/postgresql16/data" -o "-p 5432 -b " start
> Failure, exiting
> 
> Note the quoting around the -o, -p and -b arguments.
> There should perhaps be TWO double-quotes after -o or it should not be
> present.
> There should not be a double-quote after -b

Why?  pg_ctl -o is defined as an option to which is given a
string.  This string includes a set of options to pass down to the
"initdb" or "postgres" commands kicked by pg_ctl when interacting with
a.  In this case, "-p 5432 -b " looks like a valid option value to
me.  This means to start a server with port 5432, disabling
autovacuum, something that pg_upgrade requires.
--
Michael

Re: BUG #19392: PG_UPGRADE is non-functional on Windows

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:


On 2026-02-04 We 1:43 AM, David G. Johnston wrote:
On Tuesday, February 3, 2026, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      19392
Logged by:          Jeff Laing
Email address:      jeff.laing@spatialnetworx.ai
PostgreSQL version: 18.1
Operating system:   Windows 11
Description:       

After struggling with it for a while, I’ve come to the conclusion that
PG_UPGRADE is not functional on Windows.

This is a very hard to accept premise and this bug report doesn’t support it.
 


pg_upgrade is tested on Windows all the time, both in the buildfarm and in CI, so the statement that it is not functional doesn't add up.


cheers


andrew



--
Andrew Dunstan
EDB: https://www.enterprisedb.com

RE: BUG #19392: PG_UPGRADE is non-functional on Windows

От:
Jeff Laing <jeff.laing@spatialnetworx.ai>
Дата:

Mea culpa, I apologise to the list for misreading the source code.

 

My problem stemmed from pg_upgrade needing to have the superuser password available via PGPASS (or PGPASSWORD).  It’s not clear why it included the word “postmaster” in the error message which sent me off down a rathole of “it has no idea what it’s doing, perhaps its connecting to the wrong instance, etc…”

 

>>> port 5432 failed: fe_sendauth: no password supplied could not connect to source postmaster started with the command

 

I do think that having it check for not having a password and actually announcing that up front would be an improvement, rather than doing the compatibility checks, etc and waiting until it tries to startup before failing cryptically.

 

Nevertheless, I have successfully upgraded my V16 to V18 using pg_upgrade on Windows 11.

 

I can’t see how I close the ticket, but it can certainly be closed as PEBKAC

 

Jeff

 

From: Andrew Dunstan <andrew@dunslane.net>
Sent: Wednesday, 4 February 2026 11:33 PM
To: David G. Johnston <david.g.johnston@gmail.com>; Jeff Laing <jeff.laing@spatialnetworx.ai>; pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19392: PG_UPGRADE is non-functional on Windows

 

 

On 2026-02-04 We 1:43 AM, David G. Johnston wrote:

On Tuesday, February 3, 2026, PG Bug reporting form <noreply@postgresql.org> wrote:

The following bug has been logged on the website:

Bug reference:      19392
Logged by:          Jeff Laing
Email address:      jeff.laing@spatialnetworx.ai
PostgreSQL version: 18.1
Operating system:   Windows 11
Description:       

After struggling with it for a while, I’ve come to the conclusion that
PG_UPGRADE is not functional on Windows.

 

This is a very hard to accept premise and this bug report doesn’t support it.

 

 

 

pg_upgrade is tested on Windows all the time, both in the buildfarm and in CI, so the statement that it is not functional doesn't add up.

 

cheers

 

andrew

 

 

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Re: BUG #19392: PG_UPGRADE is non-functional on Windows

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:


On Wed, Feb 4, 2026, 13:53 Jeff Laing <jeff.laing@spatialnetworx.ai> wrote:

.  It’s not clear why it included the word “postmaster” in the error message which sent me off down a rathole of “it has no idea what it’s doing, perhaps its connecting to the wrong instance, etc…”



Postmaster is the name of the executable that is the server program.

We also don't have a formal bug tracker, so nothing exists to close.

David J.


RE: BUG #19392: PG_UPGRADE is non-functional on Windows

От:
Jeff Laing <jeff.laing@spatialnetworx.ai>
Дата:

>> From: David G. Johnston david.g.johnston@gmail.com
>> Sent: Thursday, 5 February 2026 10:39 AM

>>
>> Postmaster is the name of the executable that is the server program.

 

Perhaps on Unix, but I don’t think it is on Windows?

 

C:> netstat -abo

…

  TCP    0.0.0.0:5432           SPNX-1Z2SRV3:0         LISTENING       39060

[postgres.exe]

…

 

I can see that the “directory structure” has mentions of “postmaster”

 

[13:50:24.50 C:\postgresql18]

C:> dir/s/b postmaster*

C:\postgresql18\data\postmaster.opts

C:\postgresql18\data\postmaster.pid

C:\postgresql18\include\server\postmaster

C:\postgresql18\include\server\postmaster\postmaster.h

 

… but on windows, that’s not visible in the pathname of the executable.

 

[13:52:20.45 C:\postgresql18]

C:> dir/s/b postgres.exe

C:\postgresql18\bin\postgres.exe

 

Again, only an issue because in a past life, “postmaster” was a different user-id used by a completely different application, so it’s not critical, it’s just misled and sent me down the wrong blind alley.

Re: BUG #19392: PG_UPGRADE is non-functional on Windows

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Jeff Laing  writes:
> From: David G. Johnston david.g.johnston@gmail.com
>> Postmaster is the name of the executable that is the server program.

> Perhaps on Unix, but I don’t think it is on Windows?

There hasn't been a "postmaster" executable on Unix either for a few
years now.  But we still use that terminology for the server's topmost
process.  See

https://www.postgresql.org/docs/current/connect-estab.html

			regards, tom lane


FAQ