SPI_prepare and error recovery
От | Thomas Hallgren |
---|---|
Тема | SPI_prepare and error recovery |
Дата | |
Msg-id | buhl8h$12bl$1@news.hub.org обсуждение исходный текст |
Ответы |
Re: SPI_prepare and error recovery
|
Список | pgsql-hackers |
I'm using SPI_prepare to do some dynamic SQL stuff in the backend. Some errors result in a call to the elog routines with ERROR level, which in turn causes log printout and a longjmp. Since I want to trap those errors and try an alternative I tried the following: sigjmp_buf saveRestart; memcpy(&saveRestart, &Warn_restart, sizeof(saveRestart)); if(sigsetjmp(Warn_restart, 1) !=0) { memcpy(&Warn_restart, &saveRestart, sizeof(Warn_restart)); /* Handle error here */ return NULL; } void* plan = SPI_prepare(...); memcpy(&Warn_restart, &saveRestart, sizeof(Warn_restart)); return plan; My question is, at the point of /* Handle error here */, how do I get hold of the error information? Judging from the code in elog.c, this info is sent do the server and/or client log and then lost before the longjmp is made. Is that the way it's supposed to be? Regards, Thomas Hallgren
В списке pgsql-hackers по дате отправления: