From: | Alex Vinogradovs <AVinogradovs(at)Clearpathnet(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | PG_TRY(), PG_CATCH().... |
Date: | 2007-10-09 00:21:50 |
Message-ID: | 1191889310.34056.10.camel@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Guys,
I've got a C-implemented function which performs number
of SPI_exec()'s in a loop, where each of them may fail,
thus I wrapped them into the PG_TRY()/PG_CATCH() inside
the loop. Something like this :
for(i = 0; i < query_count; i++) {
PG_TRY();
{
SPI_exec(query[i], 1);
}
PG_CATCH();
{
FlushErrorState();
}
PG_END_TRY();
}
Which works fine with successful queries, but for each
unsuccessful query it complains about reference leaks
and not properly closed relations.
Later on I've solved that with use of subtransactions, which
provide some proper cleanup mechanisms, but I was wondering
if it is possible to bypass that layer, and make the code
above work fine just by doing some cleanup within the catch
block.
Thanks!
Best regards,
Alex Vinogradovs
From | Date | Subject | |
---|---|---|---|
Next Message | Ralph Smith | 2007-10-09 00:34:36 | Multiple versions on same box |
Previous Message | Rajarshi Guha | 2007-10-08 23:38:32 | speeding up CUBE queries |