1
I have to copy data from two databases to a new one, it happens that when copied new data these already exist but there are new ones that are not inserted.
The query I have at the moment is this:
INSERT INTO concelho(id,censo,concelho)
SELECT "CONCELHO","CENSO","CONCELHO_DSG"
FROM dblink('dbname=meu_db host=meu_host user=meu_user password=minha_senha' ::text,'SELECT "CONCELHO","CENSO","CONCELHO_DSG" FROM "MUNICIPIO (Concelho)"' ::text,false)
as tabela_temp("CONCELHO" varchar, "CENSO" varchar, "CONCELHO_DSG" character varying (200))
Hi user, while a dblink to localhost is generally safe (it is not exposed on the Internet), be careful not to post users and passwords here. Remember that content is indexed by search engines and is open on the Internet.
– Anthony Accioly
I don’t understand. What’s the problem? Duplicate data is entered? Or are there data that is simply ignored? There is an error message?
– Vinícius Gobbo A. de Oliveira
yes it checks that there is already an equal record, but it does not put the different
– usersantos