Re: Patch for Improved Syntax Error Reporting

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Padgett <npadgett(at)redhat(dot)com>, Dave Page <dpage(at)vale-housing(dot)co(dot)uk>, "'Fernando Nasser'" <fnasser(at)cygnus(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch for Improved Syntax Error Reporting
Date: 2001-08-03 13:24:42
Message-ID: 200108031324.f73DOga20274@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

> Neil Padgett <npadgett(at)redhat(dot)com> writes:
> >> I like the idea of putting the formatting stuff in libpq. It
> >> centralizes it, and allows the client to control the formatting too.
>
> > What exactly would you put in libpq?
>
> I think we could put in code that parses the multi-line error message
> format, and returns preparsed data in the form of a list of field names
> and field values. I don't see that libpq can do anything useful with
> producing a syntax-error pointer, since it doesn't have access to the
> original user query string, only to the same string that's sent to the
> backend; so as far as it can know, the error index that the backend
> returns is gospel. Any reverse-mapping from that to a user-query index
> has got to be in the client app, AFAICS.

Seems we could easily have the backend return a string with three tokens
before/after the syntax error, and that would be enough. It would save
the client from doing all this housekeeping just for syntax errors.

--
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-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-08-03 13:26:44 Re: ODBC Boolean handling
Previous Message Hiroshi Inoue 2001-08-03 08:43:10 Re: ODBC Boolean handling