[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trunk: load contrib functions cluster-wide or local to company database?





On Mon, Jun 8, 2009 at 2:21 PM, Jeff Kowalczyk <..hidden..> wrote:
When running the requisite steps to add contrib functions to a
new-database company file for trunk (1.3):

 $ createdb -U postgres -O ledgersmb mycompany ;
 $ createlang -U postgres plpgsql -d mycompany ;
 $ psql -U postgres -d mycompany -f /usr/share/postgresql-8.3/contrib/tsearch2.sql
 $ psql -U postgres -d mycompany -f /usr/share/postgresql-8.3/contrib/tablefunc.sql
 $ psql -U postgres -d mycompany -f /usr/share/postgresql-8.3/contrib/pg_trgm.sql

It seems like the functions are being installed to a cluster-wide
namespace location. The following error messages are returned:


Hmmm...  Try twice with a clean template1 and see if the issue is a past failure.

To clean template1:

UPDATE pg_database SET istemplate = FALSE where datname = 'template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH TEMPLATE template0;
UPDATE pg_database SET istemplate = TRUE where datname = 'template1';

Then try again twice.

Best Wishes,
Chris Travers
 


 psql:/usr/share/postgresql-8.3/contrib/tsearch2.sql:8: ERROR:  type "tsvector" already exists
 psql:/usr/share/postgresql-8.3/contrib/tsearch2.sql:9: ERROR:  type "tsquery" already exists
 psql:/usr/share/postgresql-8.3/contrib/tsearch2.sql:10: ERROR:  type "gtsvector" already exists
 psql:/usr/share/postgresql-8.3/contrib/tsearch2.sql:11: ERROR:  type "gtsq" already exists
 psql:/usr/share/postgresql-8.3/contrib/tsearch2.sql:18: ERROR:  function "lexize" already exists with same argument types
 psql:/usr/share/postgresql-8.3/contrib/tsearch2.sql:24: ERROR:  function "lexize" already exists with same argument types
 psql:/usr/share/postgresql-8.3/contrib/tsearch2.sql:30: ERROR:  function "lexize" already exists with same argument types
 ...

IIRC, and I can't find the conversation in the #ledgersmb logs to support
it, the recommendation was that the contrib functions were to be loaded
local to each company database, for isolation and re-deployment purposes.

Should psql be run with a different 'search_path', in order to install
these functions to the mycompany database only?

 /* $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.sql.in,v 1.4 2007/11/28 19:33:04 tgl Exp $ */

 -- Adjust this setting to control where the objects get created.
 SET search_path = public;

 -- These domains are just to catch schema-qualified references to the
 -- old data types.
 CREATE DOMAIN tsvector AS pg_catalog.tsvector;
 CREATE DOMAIN tsquery AS pg_catalog.tsquery;
 CREATE DOMAIN gtsvector AS pg_catalog.gtsvector;
 CREATE DOMAIN gtsq AS pg_catalog.text;

 --dict interface
 CREATE FUNCTION lexize(oid, text)
       RETURNS _text
       as 'ts_lexize'
       LANGUAGE INTERNAL
       RETURNS NULL ON NULL INPUT;
 ...

Thanks,
Jeff


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel