Thread: how can i add my own procedural language?

how can i add my own procedural language?

From
Sibtay Abbas
Date:
hi

is "Procedural language handler function" the
interface for adding your own procedural languages to
postgres?

I ve read the documentation but i am not able to
understand where do we deal with stuff like parse
trees, query trees, plan trees etc.

Ofcourse any procedural language should pass through
all the steps ie parsing, planning/optimization and
execution.

so where do we define these steps? and what interface
is provided by postgresql?

thank you

    
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 


Re: how can i add my own procedural language?

From
Thomas Hallgren
Date:
Sibtay,
> hi
> 
> is "Procedural language handler function" the
> interface for adding your own procedural languages to
> postgres?
> 
> I ve read the documentation but i am not able to
> understand where do we deal with stuff like parse
> trees, query trees, plan trees etc.
> 
> Ofcourse any procedural language should pass through
> all the steps ie parsing, planning/optimization and
> execution.
> 
> so where do we define these steps? and what interface
> is provided by postgresql?
> 
You normally don't deal with parsing, planning etc. at all from within a 
language handler.

If you want to know how to issue a SQL query from within a function, a 
good start is to look at the Server Programming Interface (SPI) . The 
functions described there are normally the ones your language handler 
will use to access the database from within the function.

http://www.postgresql.org/docs/7.4/interactive/spi.html

Take a look at the code for the languages that are bundled with 
PostgreSQL. In the source tree, you will find them under src/pl. The 
pltcl.c was very helpful to me when I first did this.

Other links where you will find source that might be helpful:

http://pgfoundry.org/projects/plperlng
http://gborg.postgresql.org/project/pljava

Regards,
Thomas Hallgren



Re: how can i add my own procedural language?

From
Doug McNaught
Date:
Thomas Hallgren <thhal@mailblocks.com> writes:

> Sibtay,

> You normally don't deal with parsing, planning etc. at all from within
> a language handler.

Unless you're implementing a language from scratch rather than linking
in an existing interpreter.  In which case, the PL/pgSQL source is a
good example.

-Doug