Search Postgresql Archives

PostgreSQL URI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

in https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING it says that the syntax for a PostgreSQL URI is:

postgresql://[user[:password]@][host][:port][,...][/dbname][?param1=value1&...]

What I don't understand is the [,...] part, i.e. optionally repeating argument.

I know that this is a valid URI:
postgresql://user1:pass1@host1:port1,host2:port2/dbname?target_session_attrs=read-write

But is the following valid?
postgresql://user1:pass1@host1:port1,user2:pass2@host2:port2/dbname?target_session_attrs=read-write

i.e. can (or should) the user[:pass] part be repeated, and possibly can even be different, if I provide more than one host:port information? Or is the user[:pass] part definitely a one-time only argument and must not appear a second time? I don't know how to read this repetition [,...] syntax. A repeat syntax usually means providing more parameters like the one immediately before that, which in this case, is the port.

I think, it should be more correct this way (note the angle bracket):
postgresql://[user[:password]@][host[:port]][,...][/dbname][?param1=value1&...]

I tried this with psql but failed miserably, though both user1:pass1 and user2:pass2 exist on both databases.

The documentation also claims that any of the parts is optional except the postgresql:// part. This means, specifying a port without a host would be perfectly fine, which IMHO makes no sense.

Can someone enlighten me? Is this just a misleading line to me in the documentation?

Cheers,
Paul





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux