Re: psql connection option: statement_timeout

From: Craig Boyd <craig(at)mysoftforge(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql connection option: statement_timeout
Date: 2016-07-03 23:47:41
Message-ID: 5779A41D.9040202@mysoftforge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 07/03/2016 06:15 PM, Melvin Davidson wrote:
>
>
> On Sun, Jul 3, 2016 at 6:54 PM, Craig Boyd <craig(at)mysoftforge(dot)com
> <mailto:craig(at)mysoftforge(dot)com>> wrote:
>
> Hello All,
>
> I am something of a newbie and I am trying to understand how to
> pass connection options using the psql client. My understanding
> is that it is possible to do this as part of the psql connection
> event.
> I am on Mint and my PostgreSQL Server version = 9.3.13.
>
> I am trying to connect to an instance on a different machine (also
> 9.3.13).
> The following works:
> psql -U username -h 192.x.x.x <enter>
>
> But when I try to set the statement like this it fails:
> psql -U username -h 192.x.x.x statement_timeout=1000
>
> I get the following "invalid connection option" I am less
> concerned with actually setting this parameter than I am learning
> how to pass or set connection options when I log in. If it is a
> case where this particular option cannot be set as part of the
> connection string that is fine. But that leads me to ask what
> options can I set as part of the connection string?
> I have looked here:
> https://www.postgresql.org/docs/9.3/static/app-psql.html
> and here:
> https://www.postgresql.org/docs/9.3/static/runtime-config-client.html
>
> I suspect I am close, but I can't seem to figure out where I am
> going awry.
> Any thoughts?
>
> Thanks in advance.
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org
> <mailto:pgsql-general(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
> I suspect what you want is connect_timeout
>
> ie: psql -U username -h 192.x.x.x connect_timeout=1000
> see examples at https://www.postgresql.org/docs/9.3/static/app-psql.html
>
> However, if you truly want to set statement_timeout, that cannot be
> set at the command line. You must execute that AFTER you connect.
> ie: # SET statement_timeout = 1000;
>
> You can also place multiple commands inside a file and then execute
> that after you connect.
> eg: # \i your_filename.sql
> --
> *Melvin Davidson*
> I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you.
Hi Melvin,

Thanks for the quick response.
That worked so thanks for that! :)

Part of what I am trying to do is understand the delineation between
those options I have at connect time as part of the connection string
versus those that should be scripted as you suggest.
The documentation, from what I can tell, kind of leaves it up to us to
figure out when something works during the connection event or not. Or
am I missing something?
So to put it another way: is there a list that shows what options are
available during the connection event or as part of the connection string?

Thanks.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2016-07-03 23:51:29 Re: psql connection option: statement_timeout
Previous Message Melvin Davidson 2016-07-03 23:15:41 Re: psql connection option: statement_timeout