Next: Write the C Code
Up: PostgreSQL: Introduction and Concepts
Previous: Summary
Extending POSTGRESQL Using C
Although POSTGRESQL offers a large
number of functions, operators, data types, and aggregates, sometimes
users may still need to create their own. Chapter
showed how to create functions in languages other than C. This chapter
covers C functions and the creation of custom operators, data types,
and aggregates that behave just like the ones already present in POSTGRESQL.
Extending POSTGRESQL in this way involves several steps:
- 1.
- Write C code to implement the new functionality.
- 2.
- Compile the C code into an object file that contains CPU
instructions.
- 3.
- Issue CREATE FUNCTION commands to register
the new functions.
- 4.
- Issue the proper commands if creating operators, data types, or aggregates:
- CREATE OPERATOR
- CREATE TYPE
- CREATE AGGREGATE
The full details of extending POSTGRESQL are beyond the scope
of this book. This chapter will therefore provide just an overview
of this topic. The Programmer's Manual mentioned in Appendix
has more detailed information.
Bruce Momjian
2005-04-21