From: | Tatsuhito Kasahara <kasahara(dot)tatsuhito(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | dblink generates orphaned connections |
Date: | 2009-09-09 05:35:37 |
Message-ID: | 4AA73EA9.5070203@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi.
dblink generates orphaned connections when we failed on performing dblink() function.
# But it occurs only when dblink('conn_str', 'sql', true). See following examples.
==============================================================================
$ pslq local
local=# SELECT datname, procpid, current_query FROM pg_stat_activity
WHERE pg_backend_pid() <> procpid;
datname | procpid | current_query
---------+---------+---------------
(0 rows)
local=# SELECT * FROM dblink('dbname=remote', 'SELECT * FROM no_exist') AS t1 (aid bigint);
ERROR: relation "no_exist" does not exist
CONTEXT: Error occurred on dblink connection named "unnamed": could not execute query.
local=# SELECT datname, procpid, current_query FROM pg_stat_activity
WHERE pg_backend_pid() <> procpid;
datname | procpid | current_query
---------+---------+---------------
remote | 29620 | <IDLE>
(1 row)
local=# SELECT * FROM dblink('dbname=remote', 'SELECT * FROM no_exist') AS t1 (aid bigint);
ERROR: relation "no_exist" does not exist
CONTEXT: Error occurred on dblink connection named "unnamed": could not execute query.
local=# SELECT datname, procpid, current_query FROM pg_stat_activity
WHERE pg_backend_pid() <> procpid;
datname | procpid | current_query
---------+---------+---------------
remote | 29620 | <IDLE>
remote | 29630 | <IDLE>
(2 rows)
==============================================================================
I think that the dblink should not ereport() before PQfinish(conn) in
dblink_record_internal() when we use temporary connection.
Attached the brief patch to avoid above problem.
Best regards,
--
Tatsuhito Kasahara
kasahara(dot)tatsuhito(at)oss(dot)ntt(dot)co(dot)jp
Attachment | Content-Type | Size |
---|---|---|
dblink.c.path | text/plain | 761 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | mahmoud badr | 2009-09-09 09:41:59 | BUG #5045: java developer |
Previous Message | vyouzhi | 2009-09-09 03:44:38 | BUG #5044: error: message type 0x5a arrived from server while idle |