Re: Trigger usecase

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: sud <suds1434(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Trigger usecase
Date: 2024-07-30 17:24:06
Message-ID: 85cc2eb0ca709ab753e618584f46dbf8801e9658.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2024-07-30 at 20:46 +0530, sud wrote:
> Now while loading transactions data we also get some reference data information from
> source (for example customer information) and for these , we dont want to modify or
> override the existing customer data but want to keep the old data with a flag as
> inactive and the new record should get inserted with flag as active. So for such
> use case , should we cater this inside the apache flink application code or should
> we handle this using trigger on the table level which will execute on each INSERT
> and execute this logic? 
>
> I understand trigger is difficult to debug and monitor stuff. But here in this case ,
> team mates is saying , we shouldn't put such code logic into a streaming application
> code so should rather handle through trigger. 
>
> I understand, technically its possible bith the way, but want to understand experts
> opinion on this and pros ans cons?

It is largely a matter of taste.

The advantage of a trigger is that it works even if somebody bypasses the application
to insert data.

I think that triggers are easy to debug, but again, that's a matter of taste.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message sud 2024-07-30 18:46:01 Re: Trigger usecase
Previous Message David G. Johnston 2024-07-30 15:41:26 Re: Trigger usecase