Postgresql – Auto increment a column based on another column avoiding race condition
Lets say I have a model Document. Document document_id -> int client_id -> int I want the document id to be auto incremented based on the client id avoiding a race condition. I have an unique constraint on document_id, client_id.…