Firing Postgres triggers on different table columns
Posted
by aatifh
on Stack Overflow
See other posts from Stack Overflow
or by aatifh
Published on 2010-04-10T07:40:42Z
Indexed on
2010/04/10
7:43 UTC
Read the original article
Hit count: 280
postgresql
|triggers
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.
© Stack Overflow or respective owner