Re: Patch for Improved Syntax Error Reporting

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Neil Padgett <npadgett(at)redhat(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch for Improved Syntax Error Reporting
Date: 2001-08-02 16:29:34
Message-ID: 200108021629.f72GTYl03412@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Barry Lind 2001-08-02 16:37:36 Re: What needs to be done?
Previous Message Tom Lane 2001-08-02 16:11:01 Re: WIN32 errno patch

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Padgett 2001-08-02 17:07:10 Re: Patch for Improved Syntax Error Reporting
Previous Message Oleg Bartunov 2001-08-02 16:16:29 Re: Fuzzy matching?