| From: | "Thomas Hallgren" <thhal(at)mailblocks(dot)com> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | SPI_prepare and error recovery |
| Date: | 2004-01-19 22:21:21 |
| Message-ID: | buhl8h$12bl$1@news.hub.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2004-01-19 23:14:52 | Re: SPI_prepare and error recovery |
| Previous Message | Tom Lane | 2004-01-19 20:53:48 | Re: Old binary packages. |