| От | Craig Ringer |
|---|---|
| Тема | Re: how to force an insert before Raise Exception? |
| Дата | |
| Msg-id | 4DAFD292.2050609@postnewspapers.com.au обсуждение исходный текст |
| Ответ на | how to force an insert before Raise Exception? (giova <giovainstall2@yahoo.fr>) |
| Список | pgsql-general |
On 19/04/11 21:39, giova wrote: > Hi. > > I made a function that Raise exception with some conditions. > No problem with that, it is the goal. > > My problem is that i want to do an INSERT into a log table before to raise > the exception. But RAISE EXCEPTION cancels my Insert. > > How to force the insert to not being cancelled please You can't have part of a transaction cancelled without cancelling all of it. The INSERT is part of the transaction. If you really need to insert a record in a log table before rolling back a transaction, you need to use dblink to do the insert in another transaction. Personally, I'd enable PostgreSQL's CSV logging and then process the log files, so you can include your logging info in the Pg logs. Using logging tables will be way more hassle than it's worth. -- Craig Ringer
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера