This is my table:

CREATE TABLE item_names
(
  item_name character varying(255) NOT NULL,
  culture_id integer NOT NULL,
  item_id integer NOT NULL,
  ft_idx_config regconfig,
  CONSTRAINT pk_item_names PRIMARY KEY (item_id, culture_id)
)

Basically the table stores strings with varying language (actually en, de,
fr, es) in the item_name column and implements the language association
using the culture_id column. I would like to run fulltext queries against
item_name + culture_id. The ft_idx_config shall be used to provide the
appropriate ts_vector config for culture_id.

Question 1: The manual mentions (
http://www.postgresql.org/docs/8.3/interactive/textsearch-tables.html) that
there's an alternative method to create a GIN index.

<quote>

"It is possible to set up more complex expression indexes wherein the
configuration name is specified by another column, e.g.:

CREATE INDEX pgweb_idx ON pgweb USING gin(to_tsvector(config_name, body));

</quote>

A little further down it is also mentioned that indexes can even concatenate
columns. Unfortunately I do not seem to be able combine both forms into:

CREATE INDEX ft_idx_item_name ON item_names USING
gin(to_tsvector(ft_idx_config, item_name || culture_id));

Which, unless I am mistaken, I would need to execute a fulltext query for a
specific language. Is there a way to solve this or do I need to change my
table layout?


Question 2: When trying to insert rows into this table (using IBatis):

INSERT INTO item_names (item_id, item_name, ft_idx_config, culture_id)
VALUES(#item_id#, #item_name#, #ft_idx_config#, #culture_id# )

I'm receiving this error: ERROR: column "ft_idx_config" is of type regconfig
but expression is of type character varying

Do I have to cast the parameter?

Reply via email to