==========================
PostgreSQL/psycopg Backend
==========================

This are notes about PostqreSQL backend based on the psycopg adapter for
Roundup issue tracker.

Prerequisites
=============

To use PostgreSQL as backend for storing roundup data, you should
additionally install:

1. PostgreSQL 7.x - http://www.postgresql.org/

2. The psycopg python interface to PostgreSQL:
   http://initd.org/software/initd/psycopg


Running the PostgreSQL unit tests
=================================

The user that you're running the tests as will need to be able to access
the postgresql database on the local machine and create and drop
databases. Edit the ``test/test_postgresql.py`` database connection info if
you wish to test against a different database.

The test database will be called "rounduptest".

Using the tsearch2 indexer
==========================

You have the option of using a different indexer for full-text searches. It is
based on tsearch2_, a module for PostgreSQL 7.3 and above. It is faster and
more scalable than the standard indexer. The tsearch2 indexer is a good choice
if you have over a 1000 issues in one tracker.

.. _tsearch2: http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/

Installation
------------

tsearch2 is available from the contrib subtree of the PostgreSQL source tree
starting with PostgreSQL 7.4. This means installing tsearch2 on Debian is
simple::

  apt-get install postgresql-contrib

FreeBSD is equally simple::

  pkg_add -r postgresql-contrib

RPM packages for Fedora Core are available from all PostgreSQL ftp mirrors_.
Packages for Suse, Mandrake and others are available from those distributors.

.. _mirrors: http://www.postgresql.org/download/mirrors-ftp

If you're compiling from source, I'm assuming you already know how to build and
install the main PostgreSQL source. Once you've done that, running the
following commands in the 'contrib' directory will build and install tsearch2::

  make all
  make install

Configuring Roundup
-------------------

Roundup implements tsearch2 as a distinct backend from the postgresql backend.
Switching to tsearch2 is the same process as `migrating to any other backend`__.

__ admin_guide.html#migrating-backends

Credit
======

The postgresql backend was originally submitted by Federico Di Gregorio
<fog@initd.org>

