pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: Bruno Boettcher <bboett@erm1.u-strasbg.fr>
Cc: pgsql-sql@postgresql.org, Jan Wieck <JanWieck@Yahoo.com>
Subject: Re: HELP: what's wrong with my PL/PSQL function??
Date: Sat, 19 May 2001 10:58:48 -0400
Message-ID: <29970.990284328@sss.pgh.pa.us> (raw)
In-Reply-To: <3B0661ED.B43C0DC6@archonet.com>
References: <20010518112136.A468@erm1.u-strasbg.fr>
	<3B0661ED.B43C0DC6@archonet.com>

Richard Huxton <dev@archonet.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.

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <29970.990284328@sss.pgh.pa.us>
Permalink:  ../29970.990284328@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29970.990284328@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dev@archonet.com, bboett@erm1.u-strasbg.fr, JanWieck@Yahoo.com
  Subject: Re: HELP: what's wrong with my PL/PSQL function??
  In-Reply-To: <29970.990284328@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox