How to create tsvector_update_trigger on Non-character type data

From: Gaini Rajeshwar <raja(dot)rajeshwar2006(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org mailing list" <pgsql-general(at)postgresql(dot)org>
Subject: How to create tsvector_update_trigger on Non-character type data
Date: 2009-10-14 06:21:15
Message-ID: 56b36eb60910132321g1ce64bd2ifa279abef1f2d1e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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*

*

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-10-14 06:29:44 Re: Cannot start the postgres service
Previous Message Mitesh51 2009-10-14 05:40:09 Re: Cannot start the postgres service