身份验证:PostgresSql 13.1 不考虑密码传递部分连接字符串参数

问题描述

最近我们将 postgres 数据库升级到了 13.1 版。 之后我们面临着连接字符串的奇怪行为

使用 Postgressql 12.3 下面的命令用于成功连接到数据库而不提示输入密码

**postgres=# \connect "dbname=dm_test_db4_db user=test_db4 host=localhost port=5432 password=password";
You are Now connected to database "dm_test_db4_db" as user "test_db4".*

使用 Postgressql 13.1 输入密码提示,如果我们提供密码连接成功。

*postgres=# \connect "dbname=dm_test_db4_db user=test_db4 host=localhost port=5432 password=password";
Password for user test_db4:
You are Now connected to database "dm_test_db4_db" as user "test_db4".*

由于这些命令是 sql 脚本的一部分,没有给出任何输入,脚本因身份验证失败而失败。

这是我的环境详细信息

postgres 版本详情: C:\Program Files\Postgresql\13\bin>postgres.exe -V postgres (Postgresql) 13.1 操作系统:Windows

这些是pg_hba.conf

中的设置
 - IPv4 local connections:

host    all             all             127.0.0.1/32            md5

 - IPv6 local connections:

host    all             all             ::1/128                 md5

知道是什么导致了这种行为吗?

解决方法

psql 的 13.1 版本(客户端程序,而不是数据库服务器)中存在一个错误。它是fixed in 13.2