specifying multiple options in URI psql behaviour?

Started by Wim Bertelsover 2 years ago4 messagesgeneral
Jump to latest
#1Wim Bertels
wim.bertels@ucll.be

Hello,

can anyone confirm this?:

* connections with at most 1 option after the ?-mark sign work:

like

#psql postgresql://myuser@myserver/mydb?connect_timeout=10

or

#psql postgresql://myuser@myserver/mydb?target_session_attrs=any

* but if you put more than 1 option, then it doesn't?:

#psql
postgresql://myuser@myserver/mydb?connect_timeout=10&target_session_att
rs=any

--

https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS

https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS

mvg,
Wim

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Wim Bertels (#1)
Re: specifying multiple options in URI psql behaviour?

Wim Bertels <wim.bertels@ucll.be> writes:

* but if you put more than 1 option, then it doesn't?:

#psql postgresql://myuser@myserver/mydb?connect_timeout=10&target_session_attrs=any

Maybe you forgot to quote that? Ampersand is a shell metacharacter.

(It does seem to work for me, as long as I put quotes around the URL.)

regards, tom lane

#3Wim Bertels
wim.bertels@ucll.be
In reply to: Tom Lane (#2)
Re: specifying multiple options in URI psql behaviour?

Tom Lane schreef op ma 02-10-2023 om 10:21 [-0400]:

Wim Bertels <wim.bertels@ucll.be> writes:

* but if you put more than 1 option, then it doesn't?:

#psql
postgresql://myuser@myserver/mydb?connect_timeout=10&target_session
_attrs=any

Maybe you forgot to quote that?  Ampersand is a shell metacharacter.

yes indeed, & bg and fg, thank you Tom

# psql
'postgresql://myuser@myserver/mydb?connect_timeout=10&target_session_at
trs=any'

or just

# psql
postgresql://myuser@myserver/mydb?connect_timeout=10'&'target_session_a
ttrs=any

Show quoted text

(It does seem to work for me, as long as I put quotes around the
URL.)

                        regards, tom lane

#4Ron
ronljohnsonjr@gmail.com
In reply to: Wim Bertels (#3)
Re: specifying multiple options in URI psql behaviour?

On 10/2/23 10:21, Wim Bertels wrote:

Tom Lane schreef op ma 02-10-2023 om 10:21 [-0400]:

Wim Bertels <wim.bertels@ucll.be> writes:

* but if you put more than 1 option, then it doesn't?:
#psql
postgresql://myuser@myserver/mydb?connect_timeout=10&target_session
_attrs=any

Maybe you forgot to quote that?  Ampersand is a shell metacharacter.

yes indeed, & bg and fg, thank you Tom

# psql
'postgresql://myuser@myserver/mydb?connect_timeout=10&target_session_at
trs=any'

or just

# psql
postgresql://myuser@myserver/mydb?connect_timeout=10'&'target_session_a
ttrs=any

Escaping the & using \ should also work.

--
Born in Arizona, moved to Babylonia.