Received: from smtp013.mail.yahoo.com (smtp013.mail.yahoo.com [216.136.173.57]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4LCjfA97120 for ; Mon, 21 May 2001 08:45:41 -0400 (EDT) (envelope-from janwieck@yahoo.com) Received: from jupiter.us.greatbridge.com (HELO jupiter.jw.home) (65.196.69.55) by smtp.mail.vip.sc5.yahoo.com with SMTP; 21 May 2001 12:45:37 -0000 X-Apparently-From: Received: (from janwieck@localhost) by jupiter.jw.home (8.9.3/8.9.3) id IAA01695; Mon, 21 May 2001 08:48:23 -0400 From: Jan Wieck Message-Id: <200105211248.IAA01695@jupiter.jw.home> Subject: Re: HELP: what's wrong with my PL/PSQL function?? In-Reply-To: <29970.990284328@sss.pgh.pa.us> from Tom Lane at "May 19, 2001 10:58:48 am" To: Tom Lane Date: Mon, 21 May 2001 08:48:23 -0400 (EDT) CC: Richard Huxton , Bruno Boettcher , pgsql-sql@postgresql.org, Jan Wieck X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200105/224 X-Sequence-Number: 3041 Tom Lane wrote: > Richard Huxton 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