Database Reference
In-Depth Information
Installing Extensions
Getting an extension into your database takes two installation steps. First, download
the extension and install it onto your server. Second, install the extension into your
database.
We'll be using the same term— install —to refer to both procedures
but distinguish between the installation on the server and the instal‐
lation into the database when the context is unclear.
We cover both steps in this section as well as how to install contribs on PostgreSQL
versions prior to extension support.
Step 1: Installing on the server
The installation of extensions on your server varies by OS. The overall idea is to down‐
load binary files and requisite libraries, then copy the respective binaries to the bin and
lib folders and the script files to share/extension (versions 9.1 and above) or share/
contrib (pre-9.1). This makes the extension available for the second step.
For smaller extensions, many of the requisite libraries come prepackaged with your
PostgreSQL installation or can be easily retrieved using yum or apt get postgresql-
contrib . For others, you'll need to compile your own, find installers that someone has
already created, or copy the files from another equivalent server setup. Larger exten‐
sions, such as PostGIS, can usually be found at the same location where you downloaded
PostgreSQL. To view all extension binaries already available on your server, enter:
SELECT * FROM pg_available_extensions ;
Step 2: Installing into a database (pre-9.1)
Before version 9.1, you had to install extensions manually by running one or more SQL
scripts in your database. By convention, if you download an extension with an installer,
it automatically dumps the additional scripts into the contrib folder of your PostgreSQL
installation. The location of this folder varies depending on your particular OS and
PostgreSQL distribution.
As an example, on a CentOS running version 9.0, to run the SQL script for the pgAdmin
pack extension, type the following from the OS command line:
psql -p 5432 -d postgres -f /usr/pgsql-9.0/share/contrib/adminpack.sql
This command calls psql noninteractively, passing in the SQL file.
Because scripts weren't packaged into extensions, there was no table of extensions to
interrogate on pre-9.1 systems.
Search WWH ::




Custom Search