Search Postgresql Archives

getting number of affected rows in dblink_exec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

In my db I have created a view that read data from a remote table
using dblink, I can modify the remote table using a couple of rules on
the view. My problem arise when I try to get the number of affected
rows since dblink_exec returns such information in a result set
instead of putting it in the return value.

Here is the relevant (simplified) sql code:

CREATE VIEW test_view AS
 SELECT test.id, test.description
   FROM dblink('dbname=xxx port=5432 host=xxx user=xxx
password=xxx'::text, 'select id, description'::text) test_view(id
integer, description character varying(100));

CREATE RULE test_view_upd AS
    ON UPDATE TO test_view DO INSTEAD
    SELECT dblink_exec('dbname=xxx port=5432 host=xxx user=xxx password=xxx',
    'update test set description = '''::text || NEW.description || '''
where id = ' || old.id) AS dblink_exec;

there is a way to create this rule in a way compatible with the
standard SQL behaviour ?

Thanks in advance,

Stefano


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux