dblink / Insert several records into remote table

Поиск
Список
Период
Сортировка
От P. Broennimann
Тема dblink / Insert several records into remote table
Дата
Msg-id CACm4aU_dthEBh4LYeu4t_1A_uOHRkB=s4n38yjP7bFjJ6L4aOg@mail.gmail.com
обсуждение исходный текст
Ответы Re: dblink / Insert several records into remote table  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-general
Hello

I'd like to use dblink to insert records (several) from a local table to a remote table. Is it possible to do this in one statement? Something like:

    insert into <remotetable> select col1, col2, col3 from <localtable>

Can someone give me an example or tell me what commands to use? What I have so far:

    l_connect_str = 'hostaddr=192.168.10.21 port=5432 dbname=db1 user=postgres password=test';
    perform public.dblink_connect('con1', l_connect_str);

    ...
                         
    perform public.dblink_disconnect('conn1');

P.S: I could "pull" the data (select) from the remote DB using dblink, but I prefer to "push" the data (insert) from the local DB to reduce the network traffic.

Thanks,
Peter

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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Bottlenecks with large number of relation segment files
Следующее
От: KONDO Mitsumasa
Дата:
Сообщение: Re: Bottlenecks with large number of relation segment files