RE: Patch for Improved Syntax Error Reporting

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'Fernando Nasser'" <fnasser(at)cygnus(dot)com>, Bruce Momjian <pgman(at)candle(dot)pha(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-04 11:37:23
Message-ID: 8568FC767B4AD311AC33006097BCD3D61A2D70@woody.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: 02 August 2001 23:12
> To: Dave Page
> Cc: 'Fernando Nasser'; Bruce Momjian; Neil Padgett;
> pgsql-patches(at)postgresql(dot)org
> Subject: Re: [PATCHES] Patch for Improved Syntax Error Reporting
>
>
> Dave Page <dpage(at)vale-housing(dot)co(dot)uk> writes:
> > However, pgAdmin does pretty much just the reformatting you've
> > suggested, including stripping of comments (well that's in the new
> > codebase anyway),
> > so:
>
> > -- Simple Query
> > SELECT
> > oid,
> > relname
> > FRUM
> > pg_class
>
> > becomes:
>
> > SELECT oid, relname FRUM pg_class
>
> > Giving the error
>
> > ERROR: parser: parse error at or near 'frum':
> > SELECT oid, relname FRUM pg_class
> > ^
>
> > Which would still be useful of course.
>
> Yes, but on that size of query you hardly need a syntax error
> pointer anyway. Consider what happens when the query is
> several thousand characters long and the error message wraps
> across several dozen lines (as does the spaces-and-caret
> pointer line). Now you really *need* that error pointer, but
> good luck making any use of what's displayed :-(

Yes, point taken.

> Another reason why the simplistic approach is not all that
> useful is that the reformatting might itself be or mask the
> problem. Suppose I fat-finger my query so that I have an
> accidentally unterminated comment, or the code recognizes a
> comment where I didn't intend one. The error message
> produced by the backend will omit the parts of the query that
> the client code thought were comments, which is likely to
> make it harder not easier for me to figure out what I did
> wrong --- not least because it eliminates cues I might
> otherwise use to figure out which part of a large query
> string is being complained about.

Again, point taken.

> Basically, upgrading syntax-error behavior to something
> useful will take some cooperation from the client side as
> well as the backend. IMHO we shouldn't dumb down our
> ambitions to be merely what can be implemented without any
> client cooperation.

Oh, I quite agree. I'm not adverse to updating my code, I just want to avoid
users getting misleading messages until I come up with those updates.

Regards, Dave.

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2001-08-04 16:55:24 Re: Patch for Improved Syntax Error Reporting
Previous Message Bruce Momjian 2001-08-04 04:23:25 Re: [BUGS] WIN32 Non Blocking