Thread: tsearch2.sql and different versions of PostgreSQL

tsearch2.sql and different versions of PostgreSQL

From
"Emil Oppeln-Bronikowski"
Date:
Hi there,

well, maybe I'm not total PgSQL noob, but I rather ask here if my
weekend Google-Fu skills are weak and problem is trivial. My problem
is like that: I took over old project by my ex employer and wanted to
clean it a bit. I realized that installer would be a good way to
resolve copy-and-edit-configuration-file approach. I hacked installer
and got myself into I-rule-mode.

All was fun and good before other company told me they can't install it.

This project relies on tsearch code. Installer hits you should have
tsearch2.sql used over your new database or on template1. On my server
CREATE DATABASE gets functions from template1 and everything works. I
assumed it will be same story for them.

But it wasn't. I run:

%apt-cache show postgresql-8.1 | grep Version
Version: 8.1.8-1~bpo.1

And they have PostgreSQL from same branch (ie. 8.1) but a little older
revision. And their tsearch2.sql and mine tsearch2.sql is different!
It gets different order and number of params, IIRC.

Is this possible? Or am I blind or unaware of something? I never had
to admin PostgreSQL database so I feel lost. :-)

If tsearch2.sql changes over versions of PgSQL, what is the best
scenario of managing installer development for PgSQL-enabled projects?
Should I wrap function calls in my own functions? Help, help! I'm
being repressed! :-)

Re: tsearch2.sql and different versions of PostgreSQL

From
Oliver Elphick
Date:
On Sun, 2007-07-29 at 14:50 +0200, Emil Oppeln-Bronikowski wrote:
...
> This project relies on tsearch code. Installer hits you should have
> tsearch2.sql used over your new database or on template1. On my server
> CREATE DATABASE gets functions from template1 and everything works. I
> assumed it will be same story for them.
>
> But it wasn't. I run:
>
> %apt-cache show postgresql-8.1 | grep Version
> Version: 8.1.8-1~bpo.1
>
> And they have PostgreSQL from same branch (ie. 8.1) but a little older
> revision. And their tsearch2.sql and mine tsearch2.sql is different!
> It gets different order and number of params, IIRC.
>
> Is this possible? Or am I blind or unaware of something? I never had
> to admin PostgreSQL database so I feel lost. :-)
>
> If tsearch2.sql changes over versions of PgSQL, what is the best
> scenario of managing installer development for PgSQL-enabled projects?
> Should I wrap function calls in my own functions? Help, help! I'm
> being repressed! :-)

If tsearch2 (or any similar contrib module) is installed from one
version of PostgreSQL it will not be automatically updated when a newer
version of the database is installed.  The new version will have the
updated code, but it needs to be installed in the various databases.

I think you need to run the SQL script tsearch2.sql.  It looks as if it
will try to create tables and functions that will already exist, so you
may have to run uninstall_tsearch2.sql first.

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.