From: Martijn van Oosterhout <kleptog@svana.org>
To: pgsql-patches@postgresql.org
Subject: Re: Proposed patch for error locations
Date: Mon, 13 Mar 2006 12:43:31 +0100
Message-ID: <20060313114331.GC6714@svana.org> (raw)
In-Reply-To: <5114.1142185055@sss.pgh.pa.us>
> The attached WIP patch improves the parser so that cursor positions
> can be attached to many errors reported during parse analysis, such
> as complaints about nonexistent columns or functions. This is along
> the lines proposed in my rant here:
> http://archives.postgresql.org/pgsql-patches/2006-02/msg00234.php> to wit, that we make use of bison's "locations" feature to track
> token positions in the grammar, and add locations to raw parse tree
> nodes as needed.
My only comment is: Wouldn't it be clearer in the long run to create a
ParseNode base structure which is used in place of NodeTag for
parsenodes, and put the "int location" in there.
Then you could create a new function called makeParseNode which works
like makeNode but takes an extra argument giving the location. Or some
variation of the two.
The thing I'm wondering is whether there will ever be any other
information we want to store, like token length so you can bracket the
expression and/or extract the exact expression with the issue. For
example, the (start,end) of a function call includes everything within
the brackets. By abstrating into a makeParseNode function, you may be
able to avoid changing a lot of code down the line.
Finally, is the count in characters or bytes (w.r.t. multibyte
encodings)?
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.
Attachments:
[application/pgp-signature] signature.asc (188B, ../20060313114331.GC6714@svana.org/2-signature.asc)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: kleptog@svana.org, pgsql-patches@postgresql.org
Subject: Re: Proposed patch for error locations
In-Reply-To: <20060313114331.GC6714@svana.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox