reliable lock inside stored procedure
| От | Sebastian Böhm |
|---|---|
| Тема | reliable lock inside stored procedure |
| Дата | |
| Msg-id | 27682F23-349D-4728-AE95-68FB6D6FE881@seb.exse.net обсуждение исходный текст |
| Ответы |
Re: reliable lock inside stored procedure
|
| Список | pgsql-sql |
Hi, I have a stored procedure and I need a SHARE ROW EXCLUSIVE lock in this procedure (otherwise data will get corrupted). According to the documentation the LOCK statement is useless and will silently fail if not executed inside a transaction. (btw: this sounds dangerous to me) Also it is not possible to start a transaction inside a stored procedure. How can I make the code of this stored procedure safe? is there a way to let the procedure fail with an error if not executed within a transaction. does adding a SAVEPOINT the trick? documentation says that savepoints can only be established inside transactions, but does it fail fatal enough so that the procedure getss aborted? (more fatal than LOCK does?) thank you very much. /sebastian
В списке pgsql-sql по дате отправления: