Re: Standalone Parser for PL/pgSQL - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Standalone Parser for PL/pgSQL
Date
Msg-id 20050714162550.GB19778@alvh.no-ip.org
Whole thread Raw
In response to Re: Standalone Parser for PL/pgSQL  (Matt Miller <mattm@epx.com>)
List pgsql-general
On Thu, Jul 14, 2005 at 03:38:43PM +0000, Matt Miller wrote:

> > > The main parser depends (at least) on the List handling and memory
> > > handling.
> >
> > The PL/PgSQL parser also depends on these, although to a lesser degree.
>
> I suppose these dependencies are okay as long as I can just link my
> parser to a library (e.g. src/pl/plpgsql/src/libplpgsql.so) and
> everything magically works.

Hmm, those symbols are defined in the main Postgres executable, so
there's no shared library to rely on.  Anyway, for the memory allocation
stuff, you should be able to

#define palloc(a) malloc(a)
#define pfree(a) free(a)

and define AllocSetContextCreate() and other MemoryContext calls defined
as no-ops.  It will leak memory like crazy, but for a short-lived
program I don't think it's a problem.

list.c you'll have to take from src/backend/nodes/list.c, I don't think
it should be too difficult.

--
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
"Porque francamente, si para saber manejarse a uno mismo hubiera que
rendir examen... ¿Quién es el machito que tendría carnet?"  (Mafalda)

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: ERROR: could not open relation
Next
From: Alvaro Herrera
Date:
Subject: Re: Standalone Parser for PL/pgSQL