Re: HELP: what's wrong with my PL/PSQL function??
| От | Tom Lane |
|---|---|
| Тема | Re: HELP: what's wrong with my PL/PSQL function?? |
| Дата | |
| Msg-id | 29970.990284328@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: HELP: what's wrong with my PL/PSQL function?? (Richard Huxton <dev@archonet.com>) |
| Ответы |
Re: HELP: what's wrong with my PL/PSQL function??
|
| Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: