tsearch2 Trigger

Поиск
Список
Период
Сортировка
Искать

tsearch2 Trigger

От:
Howard Cole <howard.cole@selestial.com>
Дата:
Hi,

I have succussfully managed to install tsearch2 and can use it happily 
with selects, ts_vectors etc. My only problem is when using a trigger in 
the form suggested in the intro documentation.

The trigger calls a function "tsearch2" which takes the tsvector column 
name, and the names of columns that the full text search is composed of.

Unfortunately, In my web application, I need to call "select 
set_curcfg('default')" before every insert/update operation or I get an 
error about the locale.

This is not a problem with searching, because I can force the locale by 
entering the configuration in the select command (e.g. 
to_tsquery('default', search)).

Can I force the command in the tsearch2 function, or can I permanently 
set the config?

Thanks.

Howard Cole
www.selestial.com

Re: tsearch2 Trigger

От:
"Joshua D. Drake" <jd@commandprompt.com>
Дата:
Вложения:
Howard Cole wrote:
> Hi,
> 
> I have succussfully managed to install tsearch2 and can use it happily 
> with selects, ts_vectors etc. My only problem is when using a trigger in 
> the form suggested in the intro documentation.
> 
> The trigger calls a function "tsearch2" which takes the tsvector column 
> name, and the names of columns that the full text search is composed of.
> 
> Unfortunately, In my web application, I need to call "select 
> set_curcfg('default')" before every insert/update operation or I get an 
> error about the locale.
> 
> This is not a problem with searching, because I can force the locale by 
> entering the configuration in the select command (e.g. 
> to_tsquery('default', search)).
> 
> Can I force the command in the tsearch2 function, or can I permanently 
> set the config?

You should only have to call set_curcfg('default') at the beginning of 
the script execution. So just make sure you call set_curcfg as the first
query in the connection, and make sure you are reusing the same 
connection for your other operations during the life of the script run.

Sincerely,

Joshua D. Drake
Command Prompt, Inc.
503-667-4564

> 
> Thanks.
> 
> Howard Cole
> www.selestial.com
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)


-- 
Command Prompt, Inc., your source for PostgreSQL replication,
professional support, programming, managed services, shared
and dedicated hosting. Home of the Open Source Projects plPHP,
plPerlNG, pgManage,  and pgPHPtoolkit.
Contact us now at: +1-503-667-4564 - http://www.commandprompt.com

FAQ