create a procedure based on column data change in postgrersql

Поиск
Список
Период
Сортировка
От Jian He
Тема create a procedure based on column data change in postgrersql
Дата
Msg-id CAMV54g3+kRnBca0WunJKEinTNgeq=y9-bXcGGNtd--DrCc3TbQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: create a procedure based on column data change in postgrersql  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-sql

This is very useful and interesting.  I can see it's very useful. I am not sure if it's costly or not? 
begin;
create temp table account_details(email text primary key, username text, password text);
insert into account_details(email, username, password) values('a.com','b','c'),('b.com','d','e');
commit;

CREATE TRIGGER trigger_update_account_details
AFTER UPDATE ON account_details
FOR EACH ROW
WHEN (OLD.email IS DISTINCT FROM NEW.email
OR OLD.username IS DISTINCT FROM NEW.username
OR OLD.password IS DISTINCT FROM NEW.password)
EXECUTE PROCEDURE notify_insert_account_details();
________________________________________________________________________
What possible  PROCEDURE notify_insert_account_details() can be. 
The following is my immature test code. 
CREATE OR REPLACE FUNCTION notify_insert_account_details()
RETURNS trigger
LANGUAGE plpgsql AS
$$
BEGIN
RAISE NOTICE 'hello world';
END
$$;
_______________________________________________________
when I update then error occurs. the update clause didn't execute. the function did fired. 
NOTICE: hello world
ERROR: control reached end of trigger procedure without RETURN
CONTEXT: PL/pgSQL function notify_insert_account_details()
______________________________________________
I am wondering how sophisticated this procedure/function notify_insert_account_details() can become, let's say linked within 3 table.
Can anyone showcase an example/demo?

I also asked same question on stackoverflow. Since it's more easy to search. (https://stackoverflow.com/questions/69631945/create-a-procedure-based-on-column-data-change-in-postgrersql),

В списке pgsql-sql по дате отправления:

Предыдущее
От: aditya desai
Дата:
Сообщение: Re: Query out of memory
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: create a procedure based on column data change in postgrersql