Обсуждение: psql connection timeout

Поиск
Список
Период
Сортировка

psql connection timeout

От
John DeSoi
Дата:
Is there a way to control how long psql waits for a connection? If the
host IP address is mistyped, psql (8.0b4) hangs for over a minute on OS
X.

Thanks,

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


Re: psql connection timeout

От
Michael Fuhr
Дата:
On Thu, Dec 02, 2004 at 11:32:34PM -0500, John DeSoi wrote:

> Is there a way to control how long psql waits for a connection? If the
> host IP address is mistyped, psql (8.0b4) hangs for over a minute on OS
> X.

Try setting the PGCONNECT_TIMEOUT environment variable:

env PGCONNECT_TIMEOUT=5 psql -h bogushost

If you always want to use a particular timeout then set the environment
variable in your shell's startup script.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: psql connection timeout

От
John DeSoi
Дата:
Hi Michael,

On Dec 2, 2004, at 11:53 PM, Michael Fuhr wrote:

> Try setting the PGCONNECT_TIMEOUT environment variable:
>
> env PGCONNECT_TIMEOUT=5 psql -h bogushost
>


This works great -- thanks very much.

I did not see this anywhere in the documentation. Did I miss it or is
the source code the only reference point?

Best,

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


Re: psql connection timeout

От
Bruce Momjian
Дата:
John DeSoi wrote:
> Hi Michael,
>
> On Dec 2, 2004, at 11:53 PM, Michael Fuhr wrote:
>
> > Try setting the PGCONNECT_TIMEOUT environment variable:
> >
> > env PGCONNECT_TIMEOUT=5 psql -h bogushost
> >
>
>
> This works great -- thanks very much.
>
> I did not see this anywhere in the documentation. Did I miss it or is
> the source code the only reference point?

I see it mentioned in the libpq section of the manual.  Those variables
actually affect all applications that use libpq, including psql.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073