Re: Need help with trigger

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Condor <condor(at)stz-bg(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Need help with trigger
Date: 2021-01-23 16:17:24
Message-ID: CAKFQuwaGMpHMoVP5Ev9YkqsUdgfLUQ5GbtSzJFPt+4D=2GTXTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Saturday, January 23, 2021, Condor <condor(at)stz-bg(dot)com> wrote:

>
>
> Hello ppl,
>
> I need help with trigger how to replace insert command with update.
> External program read data from one table and in every 30 min I need to
> refresh data in arhive table.
> What I want is: if data already inserted and end_date is not changed, only
> to update lastseen column. If data not exists to insert data and if data
> exists and end_date is changed
> to update end_date, lastseen and sendto columns. Well, update probably
> will never happened, this functionality is left for frontend but its can be
> cut off.
>

Seems like an insert on conflict would be simpler. Otherwise, what is your
question or concern?

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-01-23 16:31:15 Re: Need help with trigger
Previous Message Ron 2021-01-23 15:17:14 Re: Copy & Re-copy of DB