postgresql - How to copy tuples from a DB to another -


i think got easy problem, let's see say.

i created in new db new tables called db2. , filled db called db1.

so want import tuples von db1 db2. idea following:

insert "posts" (select * de1.posts); 

error: references other databases offers not implemented

then tried add in beginning:

select dblink_connect('dbname=db1'); dblink_connect 

but leads syntax error.

you should try shown below. please see example:

insert t2 select *  dblink('host=1.2.3.4   user=*****   password=******   dbname=d1', 'select * t1') tt(     id int,  col_1 character varying,  col_2 character varying,  col_3 int,  col_4 varchar    ); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -