Re: create a procedure based on column data change in postgrersql

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Jian He <hejian(dot)mark(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: create a procedure based on column data change in postgrersql
Date: 2021-10-19 14:37:20
Message-ID: CAKFQuwbYdEkhW3KT19-WC6D1=QY-6=UEZU0MgMT8TV7RyVRLSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Oct 19, 2021 at 6:46 AM Jian He <hejian(dot)mark(at)gmail(dot)com> wrote:

>
>
> https://stackoverflow.com/questions/25435669/fire-trigger-on-update-of-columna-or-columnb-or-columnc/25436314#25436314
> This is very useful and interesting. I can see it's very useful. I am not
> sure if it's costly or not?
>
>
> 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)
>
>
When you discover some new feature that you've never seen before on
StackOverflow (or elsewhere) I suggest you take some time to read the
documentation, which often contains examples.

In this case you seem to have discovered:
user-defined functions
pl/pgsql language functions
triggers

There is lots of excellent material and examples on how these things all
work in the documentation.

David J.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ninad Shah 2021-10-22 14:41:17 Re: Query out of memory
Previous Message aditya desai 2021-10-19 13:48:04 Re: Query out of memory