dblink not returning result

From: AI Rumman <rummandba(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: dblink not returning result
Date: 2011-11-03 07:26:11
Message-ID: CAGoODpdazm-2+18Q2cuVqsTDhcyrAstPsu=E_AFsLX607eO6Pw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am using Postgresql 9.1. I found that dblink is not returning result for
BEGIN transaction.

------------------------------------------------------------
select new_conn('conn1');
select new_conn('conn2');

select dblink_send_query('conn1','begin; update t2 set i=10 where
nam=''a1'';');
select dblink_send_query('conn2','begin; delete from t2 where
nam=''a1'';');

pgdb=# select * from lock_vw;
datname | relname | transactionid | mode | granted | usename
| current_query | query_start |
age | procpid
---------+---------+---------------+------------------+---------+----------+--------------------------------+-------------------------------+-----------------+---------
pgdb | t2 | | RowExclusiveLock | t | postgres
| <IDLE> in transaction | 2011-11-03 12:26:17.175681+06 |
00:00:04.05115 | 9414
pgdb | t2 | | ExclusiveLock | t | postgres
| begin; delete from t2 where n | 2011-11-03 12:26:17.180294+06 |
00:00:04.046537 | 9415
pgdb | t2 | | RowExclusiveLock | t | postgres
| begin; delete from t2 where n | 2011-11-03 12:26:17.180294+06 |
00:00:04.046537 | 9415
(3 rows)

select dblink_send_query('conn1','select i,nam from t2')

select * from dblink_get_result('conn1') as t2(i int, nam text);
ERROR: function return row and query-specified return row do not match
DETAIL: Returned row contains 1 attribute, but query expects 2.
select dblink_send_query('conn2','rollback');

*-- Supposed to send result here*
pgdb=# select * from dblink_get_result('conn1') as t2(i int, nam text);
i | nam
---+-----
(0 rows)

pgdb=# select * from t2;
i | nam
---+-------
1 | asdas
2 | a1
(2 rows)
------------------------------------------------------------------

Could any one please tell me why?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robins Tharakan 2011-11-03 08:14:59 Re: dblink not returning result
Previous Message Tom Lane 2011-11-03 04:53:31 Re: variable not found in subplan target list