Re: multiple calls to dblink_connect from within pl/pgSQL function exhaust connection limit

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: multiple calls to dblink_connect from within pl/pgSQL function exhaust connection limit
Date: 2009-09-23 17:52:56
Message-ID: 4783.1253728376@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com> writes:
> I use the dblink contrib module to do so. I loop through some records,
> form a connection string from those records, and do this:

> PERFORM dblink_connect(conn_str);
> ....

> Making many successive calls to this function of mine eventually
> exhausts the connection limit of my remote DBs (although I think that
> the default connection limit is something like 5 or 10, and it takes
> more calls than that). I understood from the dblink docs that calling
> this particular overload of dblink_connect wouldn't do so, because
> each subsequent call to it disconnects the last, because an "unnamed
> connection is opened, replacing any existing unnamed connection".

What PG version is this? 8.4 has a connection leak in some cases:
http://archives.postgresql.org/pgsql-committers/2009-09/msg00125.php

This fix hasn't made any released version yet, but you could apply the
source patch shown there.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Howard Cole 2009-09-23 18:08:32 Re: pgadmin is changing pgpass.conf
Previous Message Tom Lane 2009-09-23 17:31:20 Re: Source for CreatedSharedMemoryAndSemaphores