I used Postgres Database with replication.
I have used temp table in postgres function. I unable to update Temp Table while updating it through join.
Below is Postgres query(tempallergyupdates
is temp table):
drop table if exists tempallergyupdates;
create temp table tempallergyupdates(patientallergyid int,updateid int, newupdateid int);
update tempallergyupdates set patientallergyid = 1;
Above query throws bellow exception:
cannot update table "tempallergyupdates" because it does not have a replica identity and publishes updates
We just encountered this and found a solution. It turns out that PostgreSQL does not like tables, even temp tables, that lack a primary key where replication is involved. So either add one to your temp table or use a statement like this after creating the table:
ALTER TABLE table_name REPLICA IDENTITY FULL;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With