Re: How to handle error message in PG_CATCH

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to handle error message in PG_CATCH
Date: 2008-03-04 16:54:52
Message-ID: 47CD7EDC.1070309@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera napsal(a):
> Zdenek Kotala wrote:
>
>> 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)
>
> I don't see anything wrong with this code. Perhaps the problem is
> somewhere else?
>

There is whole test code. It is store procedure and there are nothing
special. The difference between this and autovacuum is that autovacuum
works without client side.

Datum
pg_check(PG_FUNCTION_ARGS)
{
PG_TRY();
{
ereport(ERROR, (errmsg("Error test")));
}
PG_CATCH();
{
errcontext("Context error");
EmitErrorReport();
FlushErrorState();
}
PG_END_TRY();
PG_RETURN_DATUM(0);
}

Zdenek

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2008-03-04 16:56:43 Re: Google Summer of Code 2008
Previous Message Jan Urbański 2008-03-04 16:47:49 Re: Google Summer of Code 2008