Re: How to use the SQL parser subsystem - Mailing list pgsql-general

From Tom Lane
Subject Re: How to use the SQL parser subsystem
Date
Msg-id 16997.1167924042@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to use the SQL parser subsystem  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> On Thu, Jan 04, 2007 at 08:01:17PM +0530, Ravindra Jaju wrote:
>> 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.

By and large there is no part of the backend that is designed to be run
standalone --- almost everything relies on palloc and elog, for instance.
I concur with the suggestion to consider doing this as a backend
function rather than in a standalone program.

Note that what raw_parser gives you is the raw grammar output, which is
probably not really what you want.  For almost any sort of interesting
analysis, I'd think you'd want to run the syntax tree through
parse_analyze() or one of its siblings, so that semantic interpretation
gets done.  There is definitely no hope of pulling out parse_analyze(),
because it has to consult the catalogs ...

            regards, tom lane

pgsql-general by date:

Previous
From: "Ravindra Jaju"
Date:
Subject: Re: How to use the SQL parser subsystem
Next
From: Arindam
Date:
Subject: Moving from 7.2.1 to 8.1.5 - looking for jdbc