Database Reference
In-Depth Information
[add_func]$ make
gcc ... -c -o add_func.o add_func.c
gcc ... -o add_func.so add_func.o
rm add_func.o
Here the " ... " stands for quite some amount of flags, includes, and libraries added
by PGXS.
This produces a dynamically loadable module in the current directory which can be
used directly by PostgreSQL if your server has access to this directory, which may
be the case on a development server.
For a "standard" server, as installed by your package management system, you will
need to put the module in a standard place. This can be done using the PGXS as
well.
You simply execute sudo make install and everything will be copied to the right
place; [add_func]$ sudo make install :
[sudo] password for hannu:
/bin/mkdir -p '/usr/lib/postgresql/9.2/lib'
/bin/sh /usr/lib/postgresql/9.2/lib/pgxs/src/
makefiles/../../config/install-sh -c -m 755
add_func.so '/usr/lib/postgresql/9.2/lib/'
CREATE FUNCTION add(int, int)
You are just one step away from being able to use this function in your database.
You just need to introduce the module you just compiled to a PostgreSQL database
using the CREATE FUNCTION statement.
If you followed the samples up to this point, the following statement is all that is
needed, along with adjusting the path appropriately to where PostgreSQL is installed
on your server.
Search WWH ::




Custom Search