Matt Miller <mattm@epx.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