pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
windows psql connection error
3+ messages / 3 participants
[nested] [flat]

* windows psql connection error
@ 2021-06-03 09:11 long Allen <zl19881003@gmail.com>
  2021-06-03 14:01 ` Re: windows psql connection error Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: long Allen @ 2021-06-03 09:11 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: windows psql connection error
  2021-06-03 09:11 windows psql connection error long Allen <zl19881003@gmail.com>
@ 2021-06-03 14:01 ` Tom Lane <tgl@sss.pgh.pa.us>
  2021-06-04 00:55   ` Re: windows psql connection error Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2021-06-03 14:01 UTC (permalink / raw)
  To: long Allen <zl19881003@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: windows psql connection error
  2021-06-03 09:11 windows psql connection error long Allen <zl19881003@gmail.com>
  2021-06-03 14:01 ` Re: windows psql connection error Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-06-04 00:55   ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2021-06-04 00:55 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: long Allen <zl19881003@gmail.com>; pgsql-bugs@lists.postgresql.org

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2021-06-04 00:55 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 09:11 windows psql connection error long Allen <zl19881003@gmail.com>
2021-06-03 14:01 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-06-04 00:55   ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox