Thread: Re: Patch for more readable parse error messages

Re: Patch for more readable parse error messages

From
Bruce Momjian
Date:
Can someone remind me where we are on this.   I seem to remember we have
to have db clients report the location because of problems with
interfaces handling the error output.

> Hi,
>
> Attached is a patch that will write out slightly more readable parse error
> messages than 'parser: parse error at or near ""'
>
> The format of the error messages is changed to:
>
> jeroen=# create abc ( a int4, b int4 );
> ERROR:  parser: parse error at or near "abc":
> create abc ( a int4, b int4 )
>         *
> jeroen=# select * from t1 where a=1 and;
> ERROR:  parser: parse error at end of:
> select * from t1 where a=1 and
>                                *
>
> The regression tests pass, except where this error is caught.
>
> Please review,
>
> Cheers,
>
>
> Jeroen

[ Attachment, skipping... ]


--
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Patch for more readable parse error messages

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Can someone remind me where we are on this.   I seem to remember we have
> to have db clients report the location because of problems with
> interfaces handling the error output.

I think we rejected that form of the patch.  ISTM the right answer is
for the backend to hand back some fairly machine-friendly indication
of the error position (character NNN, probably) and let the frontend
decide how it wants to make use of the info.  This ought to be done
in conjunction with the other changes in error reporting methods that
people have been muttering about --- supply identifiable error codes,
separate location-in-backend-code information from the error itself,
etc etc.

            regards, tom lane