GiST Access Method Installation Notes

GiST Now Included in PostgreSQL

As of mid 1997, GiST code has been incorporated into the PostgreSQL code base and is built in. Thus the instructions below on installation are no longer necessary, and included for historical reasons only. If you have a fresh copy of PostgreSQL, just download the sample opclasses and follow the instructions on installing them.


This code was developed under HP/UX. We expect the code to port with no problem, but have not done so ourselves. Before you port the code to other platforms, please check back here and see if anyone has done it for you already. If not, and you succeed in porting, contact us at!

Unfortunately, adding support for GiSTs required changing the pg_index system catalog. This means that databases from previous versions of PostgreSQL will not run under a version patched to included the GiST access method. You should dump and restore any databases you want to incorporate into the new version of PostgreSQL with GiST support.

Applying the Patch

  1. Start with a fresh version of PostgreSQL v1.02. (available from the The PostgreSQL home page
  2. cd to the top level directory of the PostgreSQL distribution, and move the pggist.patch file there
  3. run the command
         patch -p1 < pggist.patch
    Don't forget the -p1 flag!!
  4. cd src, and run gmake; gmake install
  5. initdb

Registering the Sample Opclasses

Code and SQL load files are provided for 4 GiST opclasses:
  1. gist_box_procs: allows you to index boxes a la R-trees
  2. gist_int_procs: allows you to index integers a la B-trees
  3. gist_poly_procs: allows you to index polygons a la R-trees
  4. gist_text_procs: allows you to index texts a la B-trees
To set up the SQL load files and generate the dynamic-link libraries, edit the entries at the top of the Makefile, and run gmake. Then run psql on the database of your choice, and load the sql files of interest with the \i escape command. Each sql file includes a small test at the end, which you may want to uncomment and try. N.B.: the polyproc.sql file depends on functions defined in boxproc.sql, so load boxproc.sql before loading polyproc.sql.

Comments, questions and suggestions may be directed to