Re: Locking rows
От | Tom Lane |
---|---|
Тема | Re: Locking rows |
Дата | |
Msg-id | 8766.1117144229@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Locking rows ("gabriele zelasco" <rubensoda@inwind.it>) |
Список | pgsql-general |
"gabriele zelasco" <rubensoda@inwind.it> writes: > I would like to start a transaction with a sql function. > When user press "edit" button on my form, i would lock the current row. > After user has modified data on form, pressing "save" button I would save t= > he modified row by sql update function and so commit. This is widely considered a very bad way to design an application. Consider what happens when the user leaves for lunch, or otherwise lets the app sit for a long time. See the list archives for prior discussions of the issue. But in any case, the answer to your question is to use "SELECT FOR UPDATE" to retrieve the row. And you can't start a transaction inside a function, because by definition you'll already be in one. regards, tom lane
В списке pgsql-general по дате отправления: