tsearch2_driver::install::preinstall_checks (private)

 tsearch2_driver::install::preinstall_checks

Defined in packages/tsearch2-driver/tcl/tsearch2-driver-install-procs.tcl

Make sure postgresql_contrib and tsearch are installed before allowing the installation of tsearch2_package

Author:
Hamilton Chua <hchua@8tons.dyndns.biz>
Created:
2004-07-02

Partial Call Graph (max 5 caller/called nodes):
%3 ad_script_abort ad_script_abort (public) db_0or1row db_0or1row (public) db_source_sql_file db_source_sql_file (public) tsearch2_driver::install::preinstall_checks tsearch2_driver::install::preinstall_checks tsearch2_driver::install::preinstall_checks->ad_script_abort tsearch2_driver::install::preinstall_checks->db_0or1row tsearch2_driver::install::preinstall_checks->db_source_sql_file

Testcases:
No testcase defined.
Source code:

    ns_log Notice " ********** STARTING BEFORE-INSTALL CALLBACK ****************"

    # check if tsearch2 is installed
    # in psql we do this by checking the presence of a data type tsvector
    # select typname from pg_type where typename='tsvector';

    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
    } else {

        # tsearch not installed
        ns_log Notice "******* Tsearch2 is not installed. ***********"

        # RPM, Debian, source default locations
        set locs [list "/usr/share/pgsql/contrib/tsearch2.sql"  "/usr/local/pgsql/contrib/tsearch2.sql"  "/usr/local/pgsql/share/contrib/tsearch2.sql"  "/usr/share/postgresql/contrib/tsearch2.sql"]
        foreach loc $locs {
            if { [file exists $loc] } {
                set sql_file_loc $loc
                break
            }
        }
        # Check if we've found it, run the SQL file
        if { [info exists sql_file_loc] && $sql_file_loc ne "" } {
            # we found tsearch2.sql let's run it
            db_source_sql_file $sql_file_loc
        } else {
            # we could not find tserach2.sql, abort the install
            ns_log Notice "************************************************"
            ns_log Notice "********* Can't locate tsearch2.sql. ***********"
            ns_log Notice "********* Install tsearch2.sql manually ********"
            ns_log Notice "************************************************"
            ad_script_abort
        }

    }
    ns_log Notice " ********** ENDING BEFORE-INSTALL CALLBACK ****************"
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: