Re: possible connection leak in dblink?

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: possible connection leak in dblink?
Date: 2011-06-15 02:53:16
Message-ID: BANLkTikUyAQRqgA6uWxRZ3TvyhjGzZkP-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 15, 2011 at 11:41, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> ISTM that the root problem is that dblink_send_query calls DBLINK_GET_CONN
> though it doesn't accept the connection string as an argument.

+1 for the fix. I have the same conclusion at the first glance.

> Since the first
> argument in dblink_send_query must be the connection name, dblink_send_query
> should call DBLINK_GET_NAMED_CONN instead. The variable 'freeconn' is used
> only when DBLINK_GET_CONN is called. So, if dblink_send_query uses
> DBLINK_GET_NAMED_CONN instead, the variable 'freeconn' is no longer necessary.
>
> The similar problem exists in dblink_get_result and dblink_record_internal.
> Attached patch fixes those problems.

--
Itagaki Takahiro

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-06-15 03:01:13 pg_upgrade using appname to lock out other users
Previous Message Andrew Dunstan 2011-06-15 02:44:09 Re: Why polecat and colugos are failing to build back branches