Postgresql 在azure上使用postgres创建数据库用户

Postgresql 在azure上使用postgres创建数据库用户,postgresql,Postgresql,我需要在azure上运行的postgres上创建其他用户,通常我会这样做: create user myfineuser with password 'myfinepassword'; grant connect on database myfinedatabase to myfineuser; 但是当我尝试用 psql "host=myfinehost.postgres.database.azure.com port=5432 \ dbname=myfinedatabase user

我需要在azure上运行的postgres上创建其他用户,通常我会这样做:

create user myfineuser with password 'myfinepassword';
grant connect on database myfinedatabase to myfineuser;
但是当我尝试用

psql "host=myfinehost.postgres.database.azure.com port=5432 \
    dbname=myfinedatabase user=myfineuser password=myfinepassword sslmode=require"
我确实收到了

psql: FATAL:  Invalid Username specified. Please check the Username and retry connection. The 
Username should be in <username@hostname> format.

如何使用psql实现这一点。本文只讨论用户,而不是如何指定user@host解决方案很简单:

create user myfineuser with password 'myfinepassword';
grant connect on database myfinedatabase to myfineuser;
然后在psql中:

psql "host=myfinehost.postgres.database.azure.com port=5432 \
dbname=myfinedatabase user=myfineuser@myfinehost password=myfinepassword sslmode=require"
注意myfineuser@myfinehost在psql连接字符串中。这是含蓄的

psql "host=myfinehost.postgres.database.azure.com port=5432 \
dbname=myfinedatabase user=myfineuser@myfinehost password=myfinepassword sslmode=require"