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

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard Huxton <dev(at)archonet(dot)com>, Bruno Boettcher <bboett(at)erm1(dot)u-strasbg(dot)fr>, pgsql-sql(at)postgresql(dot)org, Jan Wieck <JanWieck(at)Yahoo(dot)com>
Subject: Re: HELP: what's wrong with my PL/PSQL function??
Date: 2001-05-21 12:48:23
Message-ID: 200105211248.IAA01695@jupiter.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:
> Richard Huxton <dev(at)archonet(dot)com> writes:
> > Bruno Boettcher wrote:
> >> and i get an error:
> >> ERROR: parser: parse error at or near "$1"
> >> (BTW would be helpful if the thing could spit out also the line
> >> number....)
>
> > You can get syntax error line-numbers by editing the function in a
> > text-file and \i file to import it. Otherwise, plpgsql's error reporting
> > is a bit weak.
>
> Actually, plpgsql DOES report the line number. Into the postmaster log.
> For example:
>
> regression=# create function zz() returns int as '
> regression'# begin
> regression'# x := x + 1;
> regression'# return x;
> regression'# end;' language 'plpgsql';
> CREATE
> regression=# select zz();
> ERROR: parser: parse error at or near "x"
> regression=#
>
> tail postmaster.log shows
>
> ERROR: parser: parse error at or near "x"
> DEBUG: Last error occured while executing PL/pgSQL function zz
> DEBUG: line 2 at SQL statement
>
> 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.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Karel Zak 2001-05-21 13:01:00 Re: Case insensitive string comparison?
Previous Message tjk@tksoft.com 2001-05-21 11:53:45 Re: Case insensitive string comparison?