Skip site navigation (1) Skip section navigation (2)

Re: HELP: what's wrong with my PL/PSQL function??

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jan Wieck <JanWieck(at)yahoo(dot)com>
Cc: Richard Huxton <dev(at)archonet(dot)com>, Bruno Boettcher <bboett(at)erm1(dot)u-strasbg(dot)fr>, pgsql-sql(at)postgresql(dot)org
Subject: Re: HELP: what's wrong with my PL/PSQL function??
Date: 2001-05-21 14:16:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Jan Wieck <JanWieck(at)yahoo(dot)com> writes:
> Tom Lane wrote:
>> I am not sure why this precious info is so deeply buried.  I know why
>> it's not part of the ERROR itself: our elog mechanism doesn't support
>> that.  But seems like it could at least be made a NOTICE rather than a
>> DEBUG message.

>     Because  at  the  time  the  NOTICE  will be sent, the client
>     already  received  the  ERROR  and  doesn't  read  from   the
>     connection until the next command.  So at least you'd have to
>     send an empty query to get it.

Au contraire.  To test this, I changed elog(DEBUG)s to elog(NOTICE)s
in pl_exec.c, and now I get:

regression=# select zz();
NOTICE:  Last error occured while executing PL/pgSQL function zz
NOTICE:  line 2 at SQL statement
ERROR:  parser: parse error at or near "x"

The reason is that libpq doesn't report query done until it gets the
trailing 'Z' (ReadyForQuery) message, and the notices will come out
before that.

You might need to reword the notices a bit because they will appear
before the error itself, but this still seems to me a lot better than
having to go digging in the postmaster log (if there is one).

			regards, tom lane

In response to

pgsql-sql by date

Next:From: Adam HaberlachDate: 2001-05-21 16:06:07
Subject: Re: problem while starting server ???
Previous:From: GuruduttDate: 2001-05-21 14:09:06
Subject: Need Help!!

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group