I have a table "Documents"(id serial PK, date timestamp, name varchar, description varchar);
And another table "News"(id serial PK, date timestamp, details varchar).
*In column News.details will be the data from column Documents.description.
I would like to create a function that:
When I update the row in Documents, the row in News will be updated too.
The function uses an After Trigger.
So far I managed to test the following function, it returns no errors, but it doesn`t update the row in News:
create function update_news()
returns trigger as
if (TG_OP = 'UPDATE') then
set details = NEW.description
where details = OLD.description;
create trigger trig_news
after update on Documents for each row execute procedure update_news();
I am working with PostgreSQL.
I would like to ask if anyone can help, or share some ideas, please.