public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: sud <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: Trigger usecase
Date: Tue, 30 Jul 2024 19:24:06 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAD=mzVU0rx4A0onfC4jHxZ7XreZrk9DNa9pFoGDOjPD1ZhfHgw@mail.gmail.com>
References: <CAD=mzVU0rx4A0onfC4jHxZ7XreZrk9DNa9pFoGDOjPD1ZhfHgw@mail.gmail.com>

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






view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Trigger usecase
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox