Export to GitHub

nurpawiki - issue #51

Make DB installation possible on both Postgresql 8.2 and 8.3


Posted on Feb 20, 2008 by Happy Lion

Current schema.psql doesn't work on Postgresql 8.3 as the new 8.3 version already includes tsearch2 by default.

Things that need to be done:

1) Take out tsearch2 statements out of schema.psql and extend docs to mention that you need to install tsearch2.sql from the psql contrib directory (if memory serves me right)

2) For new 8.2 installation, install tsearch2 into its own schema so that users can export the DB contents without tsearch2 functions & datatypes. Doing this manually for DB dumps if too hard. Need to also add DB dump instructions that explain how to dump only nurpawiki tables without tsearch2 functions.

Comment #1

Posted on Feb 20, 2008 by Happy Lion

See http://www.postgresql.org/docs/8.2/static/ddl-schemas.html on the use of schemas.

Comment #2

Posted on Feb 21, 2008 by Happy Lion

What to do:

  • Create a schema for nurpawiki
  • nurpawiki schema is used for the wiki data and created for both 8.2 and 8.3+. The search path will be set so that nurpawiki code doesn't need to change.
  • For Postgresql 8.2 and earlier, load tsearch2.sql will be loaded into the public schema, thus making it easier to export only nurpawiki data for backups and migrations.

Create new SQL scripts:

  • nurpawiki_psql-8.2.sql -- use for earlier installations
  • nurpawiki.sql -- for newer

The contents of nurpawiki_psql-8.2.sql would look something like this:

8< \i tsearch2.sql \i nurpawiki.sql -- creates nurpawiki schema and sets it current 8<

nurpawiki.sql could be used as-is on Postgresql 8.3 and later.

Comment #3

Posted on Feb 22, 2008 by Happy Lion

First stab at this in r364. The change is actually quite a bit more complicated than what's said above.

Ended up not using search_path for 'nw' schema. Instead all DB ops are just prefixed with nw.

The changes creates a new schema version and moves all the DB tables under the new 'nw' schema.

As Postgresql 8.2 and 8.3 have different names for some of the tsearch2 functions, the DB upgrade code needs to dynamically adapt to different versions by renaming those functions depending on what it finds from pg_proc table.

Comment #4

Posted on Feb 23, 2008 by Happy Lion

Done. See changes between r364-r380.

Status: Fixed

Labels:
Type-Defect Priority-High Milestone-Release1.2