Copy data from one DB to another, whenever you have a new record

2

I need to copy data from a BD-1 PGSQL to another BD-2 PGSQL whenever I have a new record. I was trying to give a SELECT inside the INSERT but it is failing the connection, I already checked for various posts but I did not find a solution, could anyone give some idea how to do it or would it be anyway I was doing?

NOTE: I can not modify anything on the BD-1.

$sql1 = "INSERT INTO call_lost.teste (cod, data, hora, telefone)
SELECT q_num, time_start, from_userpart, ts_servicing FROM database_single.callcent_queuecalls WHERE ts_servicing = '00:00:00'";
$resultset = pg_query($conn1, $sql1) or die("database error:" . pg_errormessage($conn1));
    
asked by anonymous 08.01.2018 / 17:46

0 answers