Re: Patch for Improved Syntax Error Reporting - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Patch for Improved Syntax Error Reporting
Date
Msg-id 200108021629.f72GTYl03412@candle.pha.pa.us
Whole thread Raw
In response to Re: Patch for Improved Syntax Error Reporting  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
> > My 2c:
> >
> > Why not do tom's suggestion for the POSITION: n thing, and modify psql to
> > strip out that header, and output the relevant part of the sql with a caret
> > highlighting the error position.
> >
> > This will make it so that writers of the guis and format errors how they
> > like, and users of the most popular text interface (psql) get human-readable
> > results...
> >
> > ie. best of both worlds...
>
> OK, I withdraw my objection.
>
> Also, I like the idea of adding Hints and Function/line numbers to the
> output too.  The offset of the error would work into that system.

I guess the thing that bothered me is that 90% of our interfaces are
just going to throw the carret under the error line and this patch
requires us to modify all the client interfaces to do that, just to
allow 10% to customize their display.

Now, I know we are going to allow elog() to generate filename, line
number, and function name as optional output information.  We could have
a SET paramter like:

    SET SYSOUTPUT TO "message, function, offset"

and this displays:

    ERROR: lkjasdf
    FUNCTION: lkjasdf
    OFFSET: 2343

and we could have an option for HIGHLIGHT:

    HIGHLIGHT: FROM tab1, tab2
    HIGHLIGHT:      ^^^^

We could control this via GUC or via the client startup code, and
clients could grab whatever they want to know about an error.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  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

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] pltcl - lastoid
Next
From: Fernando Nasser
Date:
Subject: Re: Revised Patch to allow multiple table locks in "Unison"