Re: Standalone Parser for PL/pgSQL

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Matt Miller <mattm(at)epx(dot)com>
Cc: Neil Conway <neilc(at)samurai(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Standalone Parser for PL/pgSQL
Date: 2005-07-14 16:25:50
Message-ID: 20050714162550.GB19778@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-07-14 16:30:36 Re: Converting MySQL tinyint to PostgreSQL
Previous Message Alvaro Herrera 2005-07-14 16:18:52 Re: Standalone Parser for PL/pgSQL