Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sYobm-00EFxy-MQ for pgsql-general@arkaria.postgresql.org; Tue, 30 Jul 2024 15:17:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sYoan-00AxcO-3a for pgsql-general@arkaria.postgresql.org; Tue, 30 Jul 2024 15:16:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sYoam-00AxcG-Ll for pgsql-general@lists.postgresql.org; Tue, 30 Jul 2024 15:16:48 +0000 Received: from mail-vk1-xa32.google.com ([2607:f8b0:4864:20::a32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sYoaj-002HG0-R2 for pgsql-general@lists.postgresql.org; Tue, 30 Jul 2024 15:16:48 +0000 Received: by mail-vk1-xa32.google.com with SMTP id 71dfb90a1353d-4f51c1f9372so1729008e0c.2 for ; Tue, 30 Jul 2024 08:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722352603; x=1722957403; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Rry8pBpJzMQibcEOvTqw8Qu6f5Rf0Te0wELFnXmtrZI=; b=fLj0eXCJE+7NDmx+oPwjkjmIFr2XTjFJPuqNEIC1H2ic2d3bxGJFre6a4RE7E/uKYX SCjnKevEen/AaT0vWCw/AOA69c0+ls6TM17vmR6hsx8v/MkXwZSGN/9IdVASklFOblr4 CRSM+TqClGbDhJjtWSyeE1w7O5K2T25tOMGASvXwWBLY0XEJpItuS+rub9oLmSwI37my e44iCOXu9qT1rrRtRof9fInHXD6O+kKOfRM7pPa0J4PA/6oza/QkH9L2a9Hwh2f23qK8 WcAQYW859uOCUboYveZotGcxYnYVw/ewpv0bdg8hXvMvFhYnPBcXFST9WjtbAi4McssM V74g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722352603; x=1722957403; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Rry8pBpJzMQibcEOvTqw8Qu6f5Rf0Te0wELFnXmtrZI=; b=vazULYnl3JgTJF3pERGpQYALwBJjopOUh9t/s3zynnx9RDu/EMRYo+srt1TaszqGwc fh0yINEOIzA1iTe2N2+PrftPCTtotxJIV7B4zEQCMx45lxiFAlc6NO9fF7v9joI9Lnij 5O3iNj1ipxoB0Dqd+zbKTDYn7ueSwPwdKw8xeP3DZ/g1DN+m3OTZYrJB4+dTo9IIM1PP GbNDMbmUEGvwVawpGppJvd0PNRk8s5zNg859nr3/Jg+EoHGRhNAhCmGXOiCDwaB1MP8B OYNNzeh+Jhwoz8fzuEeERW3yVx1u+5VRj0wbmYXYw/MtMVncSpoGCUqLiPcCD8tIesyX eS7Q== X-Gm-Message-State: AOJu0Yw66dDChwwo+ZgoPTm24pM2M4Tae34ZOFQXhQCSyQX6E4+wbGlY DRKpnUs5roJHBprur9V9ytb7BGk/ffRN0niL4ClaGPaSmC0xk1URZR2Qq3cIlmzBrpR75UEP1nv hVw0OGdAFJHKxidirU+YhX8MH9yN0hQ== X-Google-Smtp-Source: AGHT+IEQSmQ3ve1J5pDFH7bU5/43IlFBjx2O27fDBhQYkAv6HGNr4Tgs38vvsxnl8Blp1VAEl5IPmfH+tyVs0HgNTt4= X-Received: by 2002:a05:6122:2025:b0:4ed:12b:ec99 with SMTP id 71dfb90a1353d-4f6e68ca53emr12619791e0c.3.1722352603405; Tue, 30 Jul 2024 08:16:43 -0700 (PDT) MIME-Version: 1.0 From: sud Date: Tue, 30 Jul 2024 20:46:32 +0530 Message-ID: Subject: Trigger usecase To: pgsql-general Content-Type: multipart/alternative; boundary="0000000000001aa887061e7877c6" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001aa887061e7877c6 Content-Type: text/plain; charset="UTF-8" Hello, We have a streaming application (using apache flink and kafka) which populates data in the tables of a postgres database version 15.4. 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? Regards Sud --0000000000001aa887061e7877c6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,=C2=A0

We have a streaming application (using apache = flink and kafka) which populates data in the tables of a postgres database = version 15.4.

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 m= odify 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 flin= k application code or should we handle this using trigger on the table leve= l which will execute on each INSERT and execute this logic?=C2=A0

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.=C2=A0

I understand, technically its possible bith the way, bu= t want to understand experts opinion on this and pros ans cons?

Regards
Sud<= /div>
--0000000000001aa887061e7877c6--