Re: Trigger usecase - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Trigger usecase
Date
Msg-id b4deb9ae-9817-497d-b33e-3967b6d5f78c@aklaver.com
Whole thread Raw
In response to Re: Trigger usecase  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
On 7/30/24 13:28, David G. Johnston wrote:
> On Tue, Jul 30, 2024 at 11:46 AM sud <suds1434@gmail.com 
> <mailto:suds1434@gmail.com>> wrote:
> 
> 
>     Not sure of the exact pros and cons, but we were following certain
>     rules like , if it's business logic which needs to be implemented in
>     Database, then it should not be done using triggers but rather
>     should be done through database procedure/functions. Hope this
>     understanding correct.
> 
> 
> That is my personal take.  For process-oriented stuff you can follow the 
> trail of calls all the way through to the end of the process and its 
> final result.  With triggers you follow the trail to the 
> insert/update/delete then stop thinking that's it, while in reality it 
> continues because you have triggers performing yet more work.
> 

"On insert/update/delete to this table the following actions are taken 
via triggers using the supplied function/procedure:

Insert
     Data is sent to audit table using table_audit()
Update
     Data is sent to audit table using table_audit()
Delete
     Data is sent to audit table using table_audit()

See function specific documentation below

[...]
"
> David J.
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Trigger usecase
Next
From: Koen De Groote
Date:
Subject: Re: Understanding conflicts on publications and subscriptions