Skip site navigation (1) Skip section navigation (2)

Re: Text search language field

From: Daniel Staal <DStaal(at)usa(dot)net>
To: PGSQL-Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Text search language field
Date: 2012-05-16 23:34:32
Message-ID: 4A6C96A2A2BAE32F48DF47C0@mac-pro.magehandbook.com (view raw or flat)
Thread:
Lists: pgsql-novice
--As of May 12, 2012 8:08:42 PM -0400, PGSQL-Novice is alleged to have said:
> Tables:
>
> Resource:
>     "text_element"	text,
>     "text_search"	tsvector,
>     "language"		char varying(3) references "languages"
>
> languages  (This is 'static' list of ISO 639-3 codes, to make sure
> everything uses the same codes):
>     "code" character varying(3) primary key,
>     "description" character varying(100)

> The trigger currently throws an error 'column "language" is not of
> regconfig type' whenever I try to use it, and I'm looking for the best
> way to solve that.  The 'simple' solution of 'create text search
> configuration eng ( copy = pg_catalog.english );' didn't work.  Before I
> start into a long exploration into why and what should be done about it,
> I thought I'd seek wisdom.  ;)

--As for the rest, it is mine.

Ok, after a bit of exploration, there are two problems with my current 
approach:

The 'config_column_name' passed to 'tsvector_update_trigger_column' cannot 
be a text column.

The config in the config column must be fully qualified.  (So I can't use 
'english', I'd have to use 'pg_catalog.english'.)

Combined, these mean I it's probably not worth trying to use the column to 
tell both my app and Postgresql what language is being used.  So, anyone 
have any ideas on how to write a trigger to pull the field from the 
language table based on the code?

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

In response to

pgsql-novice by date

Next:From: Ilija VidoevskiDate: 2012-05-17 07:38:02
Subject: Re: remote connection problem
Previous:From: Michael WoodDate: 2012-05-16 21:25:52
Subject: Re: remote connection problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group