[bug fix] dblink leaks unnamed connections

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Cc: "Peter Eisentraut (peter(dot)eisentraut(at)2ndquadrant(dot)com)" <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Subject: [bug fix] dblink leaks unnamed connections
Date: 2017-03-08 06:52:26
Message-ID: 0A3221C70F24FB45833433255569204D1F6ADF8C@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

dblink fails to close the unnamed connection as follows when a new unnamed connection is requested. The attached patch fixes this.

postgres=# select count(*) from pg_stat_activity;
count
-------
1
(1 row)

postgres=# select dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
(1 row)

postgres=# select count(*) from pg_stat_activity;
count
-------
2
(1 row)

postgres=# select dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
(1 row)

postgres=# select count(*) from pg_stat_activity;
count
-------
3
(1 row)

Regards
Takayuki Tsunakawa

Attachment Content-Type Size
dblink_leak_unnamed_conn.patch application/octet-stream 490 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2017-03-08 07:00:16 Re: Parallel Append implementation
Previous Message Michael Paquier 2017-03-08 06:50:08 Re: CREATE/ALTER ROLE PASSWORD ('value' USING 'method')