Do I have to lock table in this case?
Do I have to lock table in this case?
От:
Ondrej Palkovsky <xpalo03@vse.cz>
Дата:
I have a table like this:id primary keyunique I need to do:- if 'unique' exists in table, return appropriate id else insert into table new id. Now doing: select id where unique=%s insert/update creates a race condition. The application can theoretically rollback & redo the whole transaction (not simple in some cases). What is the preferred solution to this problem (I got about 3 such cases in one simple application). Ondrej -- It is better to remain childless than to father an orphan.