getting number of affected rows in dblink_exec

Поиск
Список
Период
Сортировка
От Stefano Salvador
Тема getting number of affected rows in dblink_exec
Дата
Msg-id cf192dd0805200334h139888e0t8e358f557b399a65@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Maarten Deprez
Дата:
Сообщение: escaping and quoting
Следующее
От: Kevin Hunter
Дата:
Сообщение: Re: i am looking for postgresql hosting server