Firing Postgres triggers on different table columns
- by aatifh
CONTENT_TABLE
id | author | timestamp | title | description
----+-----------------+-----------+----------------+----------------------
(0 rows)
SEARCH_TABLE
id | content_type_id | object_id | tsvector_title | tsvector_description
----+-----------------+-----------+----------------+----------------------
(0 rows)
I have to fire a trigger when ever CONTENT_TABLE is UPDATED/INSERTED
Something like this:
"CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE ON course_course FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(SHOULD_BE_THE_COLUMN_OF_SEARCH_TABLE(tsvector_description), 'pg_catalog.english', description);"
Actually, i have to add tsvector for title and description of the CONTENT_TABLE to the table SEARCH_TABLE tsvector_title and tsvector_description. Can i just fire one trigger for it?
Any sort of help will be appreciated. Thanks in advance.