Database Reference
In-Depth Information
Summary
As C is the language that PostgreSQL itself is written in, it is very hard to draw a
distinction on what is an extension function using a defined API and what is hacking
PostgreSQL itself.
Some of the topics that we did not touch at all were:
• Creating new installable types from scratch—see
contrib/hstore/
for
a full implementation of a new type.
• Creating new index methods—download some older version of Posr-
greSQL to see how full text indexing support was provided as an add-on.
• Implementing a new PL/* language—search for
pl/lolcode
for a lan-
guage whose sole purpose is to demonstrate how a PotgreSQLs PL/* lan-
guage should be written (see
http://pgfoundry.org/projects/pllolcode/
)
. You
also may want to check out the source code for PL/Proxy for a clean and
well maintained PL language. (The usage of PL/Proxy is described in the
next chapter.)
Hopefully this chapter gave you enough info to at least start writing PostgreSQL ex-
tension functions in C.
If you need more than what is available here or in the official PostgreSQL docu-
mentation, then remember that lots of PostgreSQLs backend
developer
document-
ation—often including answers to the questions
How?
and
Why?
—is in the source
files. And lot of that can be relevant also to C extensions.
So remember—Use The Source, Luke!