Error in postgres SQL statement...

Posted on 2007-07-20
Last Modified: 2008-01-09

I am brand new to Postgres DB's.. I have a SQL file that I'm trying to import, and it contains a few statements like:

CREATE FUNCTION lexize(oid, text) RETURNS text[]
    AS '$libdir/tsearch2', 'lexize'

and when I try and run that SQLI get: ERROR:  could not access file "$libdir/tsearch2": No such file or directory..

Can someone point me in the right direction?

Question by:dwessell
    LVL 9

    Accepted Solution

    It looks as if either TSearch2 is not installed, or $libdir is pointing to the wrong place.

    To get the value for $libdir, can you give me the output of running `pg_config --pkglibdir` at shell prompt?

    After that, try running `locate` to find out if TSearch2 is installed, and if it is, if it's in the folder that is returned by running `pg_config --pkglibdir`.

    There's a good discussion of this exact issue on the pgsql-sql archives:

    Author Comment


    The output of pg_config --pkglibdir is '/usr/lib/pgsql'/

    And the search for turned up nothing...

    I read the thread you pointed me towards, but I couldn't garner much information from it.. Could be because I'm still on the first cup of coffee... But I"ll come back to it shortly and try again... Any suggestions always welcome..


    Author Comment

    I'll give some more information to, this might be helpful.. I'm on a VPS, using WHM and Cpanel.. I installed Postgres myself from WHM, by installing the php-pgsql RPM... Then recompiled php using the postgres switch... I'm still pretty new to linux, so probably something I didn't do :)


    Author Comment


    I installed postgres using the informatino in this link:

    Then I installed the php-pgsql RMP, then recompiled PHP...

    From what I can tell, I need to install Tsearch2 from source.. But I'm falling short on finding informatino on how to do that..


    Author Comment

    I'm trying to complie tsearch2, but I get this error (using gmake)
    Makefile:31: ../../src/ No such file or directory
    Makefile:32: /contrib/ No such file or directory
    gmake: *** No rule to make target `/contrib/'.  Stop.

    In the .src file, there is a file.. Should I remove the .in? Or do I need to modify the Makefile in the tsearch2 dir (I tried this, but it threw similar errors about another file)...
    LVL 9

    Expert Comment

    Which version of Postgres are you installing from RPM?

    You actually need to place the TSearch2 code within the Postgres source tree in order to compile: the you are missing is the one from Postgres and not from anything you'd find in the TSearch2 source tarball.

    The procedure for building against a 7.4.x (and later) version is a little bit easier than a 7.3.x version.  Let me know which you are running from the tarball and we'll proceed from there.

    Author Comment

    I found a RPM of the options that matched my version, and installed it.. All is well now... Thanks for all of the suggestions!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Title # Comments Views Activity
    SQL help 5 42
    query question - where clause with a max involved 7 42
    Case statement to sum values - T-SQL 3 29
    Pl/SQL Query 31 36
    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    Creating and Managing Databases with phpMyAdmin in cPanel.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now