ERROR: could not serialize access due to concurrent update (SQLSTATE 40001)

143 Views Asked by At

this is the code I have, it is a simple update :

 UPDATE foregin_schema.foreign_table a
        SET wa_round =  b.u_round,
            update_date = b.lst_update,
            round_batch_id = null
        FROM (select s.u_round, s.user_id, s.lst_update
              from local_server_table s
              where s.must_be_insert = 0) b
        WHERE a.user_id = b.user_id;

the problem here is the error which happens sometimes but not always

ERROR: could not serialize access due to concurrent update (SQLSTATE 40001)

foregin_schema.foreign_table is an imported table from another server and on this table always happens another updates but how can I skip the locked rows? is this a server problem or some isolation-level problem?

0

There are 0 best solutions below