Re: How to use the SQL parser subsystem

Поиск
Список
Период
Сортировка
От Ravindra Jaju
Тема Re: How to use the SQL parser subsystem
Дата
Msg-id d65123830701040703v2761f0ceyf092ccc58cc3fa74@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to use the SQL parser subsystem  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Hi.

That was informative. Thanks.

The reason I started pursuing this path was that this file (parser/parser.h) happens
to be distributed as part of some 'devel' package, making me think that it might
be possible to re-use the SQL parsing functionality that exists within postgres.

Even if it is in the backend, I guessed that there might be a .so related to the backend
which I could link against. Not so...

If someone can confirm that there is no known utility which uses postgres codebase to
play with SQL statements, then it would make sense for me to try and hack something.

regards,
jaju

On 1/4/07, Martijn van Oosterhout <kleptog@svana.org> wrote:
On Thu, Jan 04, 2007 at 08:01:17PM +0530, Ravindra Jaju wrote:
> I tried peeking around a bit, and tried pulling out src/backend/parser - but
> that depends on other parts of the code, making it a bit non-trivial. Plus,
> any changes in the base code upstream would not be available to this
> pulled-out application over time. Looking further, I noticed on my Fedora
> distribution that the pg devel package has a parser/parser.h file which
> exposes the function 'raw_parser' which is the function that seemed most
> interesting to me while exploring the code too.

Note that that's a *backend* header file.

> I have some questions:
> 1] is 'raw_parser' the right function to parse an SQL statement (for mainly
> structural/syntactic analysis)?

I beleive it's the function used y postgres internally, not sure
though.

> 2] If yes, I found that none of the shared library files expose this
> function - I could not link a simple C program with this function
> successfully. (I tried all the .so files related to postgres! :-()

It's inside the server, it's not in a seperate library. To use it you
need to be inside the server.

> 3] If not, what would be a better mechanism to re-use all the work already
> done in postgres for SQL analysis?

No idea.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFnROLIB7bNG8LQkwRApb+AJ9z8V9p3krQ9zxGCB/yQCFPVNg2XgCeLZGl
qDi9lewzfJmPfM23lht/p7E=
=tk7B
-----END PGP SIGNATURE-----



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

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: How to use the SQL parser subsystem
Следующее
От: Karsten Hilbert
Дата:
Сообщение: self-referential UPDATE problem on 7.4