Re: Problem compiling function with BEGIN WORK; COMMIT WORK;
В списке pgsql-general по дате отправления:
| От | Craig Ringer |
|---|---|
| Тема | Re: Problem compiling function with BEGIN WORK; COMMIT WORK; |
| Дата | |
| Msg-id | 4BD3ABC7.9010206@postnewspapers.com.au обсуждение исходный текст |
| Ответ на | Problem compiling function with BEGIN WORK; COMMIT WORK; (Andre Lopes <lopes80andre@gmail.com>) |
| Список | pgsql-general |
On 25/04/2010 9:07 AM, Andre Lopes wrote: > Hi, > > I need to use the BEGIN WORK; and COMMIT WORK; to lock a table when I'am > doing a SELECT and UPDATE operation. PostgreSQL's server-side functions do *not* support transaction management. They're functions that're used inside an existing transaction. However, if you do not explcitly BEGIN a transaction before calling your function, the statement your function runs in will start and stop its own transaction. In other words, these two things are equivalent: BEGIN; SELECT my_function(); COMMIT; and SELECT my_function(); (outside an existing transaction) Because your function is *always* inside a transaction, it can always acquire locks and the like. It doesn't need to explicitly start a transaction first. -- Craig Ringer
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера