Alvaro Herrera wrote:
I don't think you can use just plpgsql's parser. The problem is that it relies on the main backend parser to figure out anything it doesn't understand.
I think it depends on what kind of information you want to extract from a PL/PgSQL function definition. The PL/PgSQL parser handles the structure of the PL/PgSQL function definition itself, but it does not parse expressions or SQL queries. Those are essentially treated as strings that are later handed to the main SQL machinery to be parsed and evaluated. If you're content to treat expressions and SQL queries as opaque strings, you shouldn't need to concern yourself with the main SQL parser.
The main parser depends (at least) on the List handling and memory handling. So your "simple standalone parser" will have to contain both things at least.
The PL/PgSQL parser also depends on these, although to a lesser degree. -Neil ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster