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

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: HELP: what's wrong with my PL/PSQL function??
Дата
Msg-id 200105211248.IAA01695@jupiter.jw.home
обсуждение исходный текст
Ответ на Re: HELP: what's wrong with my PL/PSQL function??  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: HELP: what's wrong with my PL/PSQL function??
Список pgsql-sql
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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Cedar Cox
Дата:
Сообщение: Re: Case insensitive string comparison?
Следующее
От: Karel Zak
Дата:
Сообщение: Re: Case insensitive string comparison?