Re: exporting raw parser

Поиск
Список
Период
Сортировка
От Daniel Farina
Тема Re: exporting raw parser
Дата
Msg-id AANLkTimxAdL0P9Cmfn0ZwVU23N_4kBE8iTXiw1epQHZ7@mail.gmail.com
обсуждение исходный текст
Ответ на exporting raw parser  (Tatsuo Ishii <ishii@postgresql.org>)
Ответы Re: exporting raw parser  (Dimitri Fontaine <dfontaine@hi-media.com>)
Список pgsql-hackers
On Wed, May 26, 2010 at 6:02 PM, Tatsuo Ishii <ishii@postgresql.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [PATCH] Fix leaky VIEWs for RLS
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: nvarchar notation accepted?