BUG #16746: [PG12.5 psql] Password ignored by connect meta-command

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: kgradekx(at)gmail(dot)com
Subject: BUG #16746: [PG12.5 psql] Password ignored by connect meta-command
Date: 2020-11-26 10:47:41
Message-ID: 16746-44b30e2edf4335d4@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16746
Logged by: Krzysztof Gradek
Email address: kgradekx(at)gmail(dot)com
PostgreSQL version: 12.5
Operating system: Centos
Description:

Hi
I just migrated my app to PG 12.5 and jumped into an issue which didn't
exist in PG12.3: the password provided in connection URI is ignored by
connect meta-command.

Steps to reproduce:
1. open PG12.5 psql
2. run connect command using connection URI -> instead of opening the
connection I get password prompt.

$ psql
psql (12.5)
Type "help" for help.

postgres=# \connect
postgresql://ph_quartz_user:password(at)127(dot)0(dot)0(dot)1/ph_quartz
Password for user ph_quartz_user:

Same sequence using earlier version:
$ /usr/pgsql-9.4/bin/psql
psql (9.4.4, server 12.5)
WARNING: psql major version 9.4, server major version 12.0.
Some psql features might not work.
Type "help" for help.

postgres=# \connect
postgresql://ph_quartz_user:password(at)127(dot)0(dot)0(dot)1/ph_quartz
psql (9.4.4, server 12.5)
WARNING: psql major version 9.4, server major version 12.0.
Some psql features might not work.
You are now connected to database "ph_quartz" as user "ph_quartz_user"
on host "127.0.0.1" at port "5432".

Of course, 9.4 is very old version, but the same test at another env with
PG12.3 succeeded (I could connect).

I have checked various options for the connection string (as described in
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING),
none worked. It looks like the password parameter is simply ignored.

Also, I have checked the changes done to PG 12.5 - I found that 3 recent
commits relate to the connect meta-command (src/bin/psql/command.c):

https://github.com/postgres/postgres/commit/1b62d0fb3e50ede570d0d4e4a2be69d5645b48a7#diff-657963643e18c39703a2b162c0d1c002584c16289deff8614165544e4a4470c6

https://github.com/postgres/postgres/commit/94929f1cf6cb3ea070d0919d1303379b525a72a3#diff-657963643e18c39703a2b162c0d1c002584c16289deff8614165544e4a4470c6

https://github.com/postgres/postgres/commit/85c54287af56fe351b53913ea2b81e9d6145f964#diff-657963643e18c39703a2b162c0d1c002584c16289deff8614165544e4a4470c6

I cannot explain where is the issue but IMO the problem stems from these
changes.

Hope, you can help.
BR

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dave Page 2020-11-26 11:38:35 Re: pgadmin--pgagent---the process hang by unknow reasons
Previous Message Fahar Abbas 2020-11-26 09:42:54 Re: Ошибка_установки_postgresql 11_в_ windows