How to handle error message in PG_CATCH

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: How to handle error message in PG_CATCH
Date: 2008-03-04 09:11:47
Message-ID: 47CD1253.3090508@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm working on implementing pg_check functions. Because I want to test
whole table I need catch a error and handle it myself. I use following
construct:

PG_TRY();
{
...
ereport(ERROR, (errmsg("Error test")));
...
}
PG_CATCH();
{
errcontext("Context error");
EmitErrorReport();
FlushErrorState();
}
PG_END_TRY();

At the end I got following message:

ERROR: Error test
CONTEXT: Context error
server sent data ("D" message) without prior row description ("T" message)

and also nothing appears in a log file. Similar concept is used in
autovacuum.c.

Any idea what is wrong?

Thanks for help Zdenek

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2008-03-04 09:51:05 Re: "could not open relation 1663/16384/16584: No such file or directory" in a specific combination of transactions with temp tables
Previous Message Zdenek Kotala 2008-03-04 08:55:39 Re: Replacing the corrupt "global" folder with older one