Re: Standalone Parser for PL/pgSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matt Miller <mattm(at)epx(dot)com>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Standalone Parser for PL/pgSQL
Date: 2005-07-14 18:28:51
Message-ID: 21452.1121365731@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Matt Miller <mattm(at)epx(dot)com> writes:
> ... The stuff in src/pl/plpgsql/src/
> looked like a good starting point. gram.y and scan.l are there.
> pl_funcs.c has some cool-looking "dump*" functions. Now, can this stuff
> be "straightforwardly" hacked into a program that gets its PL/pgSQL
> source code from STDIN or from a text file, instead of from the "AS"
> clause of a "CREATE FUNCTION" statement?

Try to compile those as a standalone program. Observe the undefined
symbols you get. Add other backend modules to your compile (or build
stub versions). Lather, rinse, repeat until it links.

I think 90% of what you'd need is replacements for palloc and elog.
palloc can be turned into a simple malloc-and-check-for-failure,
and elog can probably just print the message and exit.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Bryden 2005-07-14 19:42:04 Help needed with PGOleDB driver and ADO
Previous Message Jaime Casanova 2005-07-14 18:12:26 Re: i need you help about postgresql(rollback)