From: | Daniel Farina <drfarina(at)acm(dot)org> |
---|---|
To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: exporting raw parser |
Date: | 2010-06-07 07:17:06 |
Message-ID: | AANLkTimxAdL0P9Cmfn0ZwVU23N_4kBE8iTXiw1epQHZ7@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, May 26, 2010 at 6:02 PM, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
> I'm thinking about exporting the raw parser and related modules as a C
> library. Though this will not be an immediate benefit of PostgreSQL
> itself, it will be a huge benefit for any PostgreSQL
> applications/middle ware those need to parse SQL statements.
In the past I and people I have known/worked with have made strategic
use of UDFs running on a live server that return the parse tree,
semantically analyzed tree, and planned tree (I think) outNode textual
representation for various projects, and found them highly useful.
Syntactic, semantic, and operational meaning of a query was useful for
our projects.
Some of this code was linked with the server, and so reading the node
using Postgres' parser was easy. Otherwise, a small parser needed be
written for external projects. Perhaps a slightly more ideal state of
affairs would be:
* These hooks to acquire the syntactic/semantic/planned trees would be
bundled "for free"
* When writing code not linked against the server, a more common
serialization format, ala JSON or whatnot
A more ambitious project that I don't think is in the scope of any
initial implementation would be to allow for cross referencing of
these compilation passes, similar to how GNU Bison allows you to
interrogate for the position of a lexeme when reporting errors. In my
experience, code written that mangles one layer (say, semantic, or
harder yet, plan) has a hard time doing the best error because getting
from a node at the "bottom" to the right lexeme(s) at the "top" is
very cumbersome. One could imagine this being useful for other
purposes too, but that is how I felt it firsthand. Feels a lot harder,
though.
fdr
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2010-06-07 07:23:58 | Re: nvarchar notation accepted? |
Previous Message | Heikki Linnakangas | 2010-06-07 06:48:59 | Re: [PATCH] Fix leaky VIEWs for RLS |