pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Wieck <JanWieck@Yahoo.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: 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: Mon, 21 May 2001 08:48:23 -0400 (EDT)
Message-ID: <200105211248.IAA01695@jupiter.jw.home> (raw)
In-Reply-To: <29970.990284328@sss.pgh.pa.us>

Tom Lane wrote:
> 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.

    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@Yahoo.com #



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




view thread (5+ messages)  latest in thread

Message-ID: <200105211248.IAA01695@jupiter.jw.home>
Permalink:  ../200105211248.IAA01695@jupiter.jw.home/
Also on:    postgresql.org/message-id/200105211248.IAA01695@jupiter.jw.home

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

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

* 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