Forum OpenACS Q&A: Tsearch2 install fails with PostgreSQL 8.2

Following an installation failure I found that the query that threw the error was this one:

select typname from pg_type where typname='tsvector';
typname
----------
tsvector
tsvector
(2 rows)

Why have I got two rows here I wonder?

Expanded display is on.
server=# select * from pg_type where typname='tsvector';
-[ RECORD 1 ]-+-------------
typname | tsvector
typnamespace | 11
typowner | 10
typlen | -1
typbyval | f
typtype | b
typisdefined | t
typdelim | ,
typrelid | 0
typelem | 0
typarray | 3643
typinput | tsvectorin
typoutput | tsvectorout
typreceive | tsvectorrecv
typsend | tsvectorsend
typmodin | -
typmodout | -
typanalyze | -
typalign | i
typstorage | x
typnotnull | f
typbasetype | 0
typtypmod | -1
typndims | 0
typdefaultbin |
typdefault |
-[ RECORD 2 ]-+-------------
typname | tsvector
typnamespace | 2200
typowner | 10
typlen | -1
typbyval | f
typtype | d
typisdefined | t
typdelim | ,
typrelid | 0
typelem | 0
typarray | 0
typinput | domain_in
typoutput | tsvectorout
typreceive | domain_recv
typsend | tsvectorsend
typmodin | -
typmodout | -
typanalyze | -
typalign | i
typstorage | x
typnotnull | f
typbasetype | 3614
typtypmod | -1
typndims | 0
typdefaultbin |
typdefault |
server=#

The latest version of Postgres seems to have two tsvector entries where previously there was only one. I found the following link which shows that this quesry occurs in the code that verifies that tsearch2 is installed in the DB.

https://openacs.org/api-doc/proc-view?proc=tsearch2_driver::install::preinstall_checks&source_p=1&version_id=

This problem would seem to be a bug caused by the fact that under PostgreSQL 8.2 there are two tsvector rows (maybe to do with built in UTF-8 support) but Hamilton Chua's install script, which checks for the presence of tsvector to verify that tsearch2 is installed in the db uses db0_or_1row which therefore throws an error.

This presumably needs to be changed in HEAD to something like:

if { [db_0or1row "tsearch_compile_check" "select true from pg_type where typname='tsvector'"] } {

# if tsearch is installed
ns_log Notice "******* Tsearch2 is compiled and installed. ***********"
# continue with installation

However I do not have access to cvs.

Regards
Richard

Collapse
Posted by Richard Hamilton on
Actually, no sorry - that won't do it.

How about this instead?:

if { [db_0or1row "tsearch_compile_check" "select distinct typname from pg_type where typname='tsvector'"] } {

# if tsearch is installed
ns_log Notice "******* Tsearch2 is compiled and installed. ***********"
# continue with installation

Collapse
Posted by Don Baccus on
This should work, yes.
Collapse
Posted by Richard Hamilton on
Don,

I have just tried to install the tsearch2 driver in a fresh openacs 5.5.1 and the problem still exists.

When you replied you may have thought I had access or authorisation to change this. At the time I did not, but of course now I do.

I will post this in the bugtracker for the maintainer, but perhaps as it is a simple change someone could either do it or authorise me to do it.

Regards
Richard

Collapse
Posted by Don Baccus on
Yeah, please go ahead and fix that (on HEAD, I'm hoping oacs-5-5 acs-core is DEAD regarding future releases).

Please post or e-mail when we do, I'll make sure install on pg 8.4 works.

Collapse
Posted by Richard Hamilton on
Thanks, I'll do that asap.

R.

Collapse
Posted by Richard Hamilton on
Don,

I have committed that change, hopefully correctly! 😊

R.