Hello, I'm developing a sales screen in C # Windows Forms. I'm just in the beginning of the project, but I came across a situation where I'm not sure what to do. I am using a PostgreSQL database, I created a table called SALE and another ITEMSEND. The logic I am using is as follows: When inserting the first product it creates a row in the SALES table generating a code that is of type SERIAL. This code is then stored and used to insert the items from that sale into the ITENDS table. That's where the problem comes from, when there is more than one machine inserting at the same time, it may be a problem to insert items with COD from the wrong sale, if I happen to record several sales at the same time, just because I need to recover the code from my sale that I am doing on my machine. What is the best way for me to solve this problem? What do you do to not end up throwing items in on sales other than mine?