Answer the question
In order to leave comments, you need to log in
How to lock postgresql table on insert?
I'm trying to implement an analogue of upsert in a function. Whether it is possible to lock the table on insert of new records, before check whether there is a record with current values?
Now something like
if (SELECT COUNT(*) FROM ...
where ...) THEN
UPDATE ...;
ELSE
INSERT INTO ...;
END IF;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question