How to create tsvector_update_trigger on Non-character type data - Mailing list pgsql-general

From Gaini Rajeshwar
Subject How to create tsvector_update_trigger on Non-character type data
Date
Msg-id 56b36eb60910132321g1ce64bd2ifa279abef1f2d1e@mail.gmail.com
Whole thread Raw
Responses Re: How to create tsvector_update_trigger on Non-character type data
List pgsql-general
Hi,
How can we create tsvector update trigger on Non-character data type.
For example,  i have created a ts vector trigger something like this.
CREATE TRIGGER tr_doc_id_col
BEFORE INSERT OR UPDATE
ON document
FOR EACH ROW
EXECUTE PROCEDURE tsvector_update_trigger('tsv_doc_id', 'pg_catalog.english', doc_id');
Here,
tr_doc_id_col -- Name of the trigger
document -- Name of the table
tsv_doc_id -- tsvector form of the doc_id
doc_id -- Name of the column. It's data type is integer
This trigger should update the tsv_doc_id, when there is insert, delete or update happens on doc_id column.
But, the trigger is throwing an error saying that doc_id is not of character type (i.e it is not able to update based on non-character type column).
I have tried creating same kind of triggers on columns like title, body which are text data type. In this case it is working very well, but in the earlier case.
Can any of you tell me how to do in the case of non-character data type like doc_id?
Thanks,
Gaini Rajeshwar

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Cannot start the postgres service
Next
From: Scott Marlowe
Date:
Subject: Re: Cannot start the postgres service