windows psql connection error
Hello:
PostgreSQL version: 12.6
Operating System: Windows Server 2012
When I execute commands "psql postgres -p 5433" in Windows, the system
reported an error “"extra command-line argument **** ignored“.
The same command can be executed successfully in CentOS7 and connect to
the database.
I read the source code and found that it was getopt_long function problem.
it returns value -1. so skip the while loop.
I am not sure it's a bug or not.
regards
---
Allen
long Allen <zl19881003@gmail.com> writes:
When I execute commands "psql postgres -p 5433" in Windows, the system
reported an error “"extra command-line argument **** ignored“.
We do not document nor support writing switches (i.e. "-p 5433") after
non-switch arguments. Some versions of getopt_long make that magically
work anyway, but others do not.
regards, tom lane
On Thu, Jun 03, 2021 at 10:01:54AM -0400, Tom Lane wrote:
long Allen <zl19881003@gmail.com> writes:
When I execute commands "psql postgres -p 5433" in Windows, the system
reported an error “"extra command-line argument **** ignored“.We do not document nor support writing switches (i.e. "-p 5433") after
non-switch arguments. Some versions of getopt_long make that magically
work anyway, but others do not.
Just to bring in a bit more context.. Any code compiled with MSVC on
Windows would use the fallback implementation of getopt_long() in
src/port/getopt_long.c, which only supports the case where the extra
argument is at the end of the command.
--
Michael