Re: Need help with trigger
От
Adrian Klaver
Тема
Re: Need help with trigger
Дата
Msg-id
3294def5-09f6-c384-d1fe-f5faf4bcf797@aklaver.com
Ответ на
Re: Need help with trigger (Condor)
Список
Дерево обсуждения
Need help with trigger Condor <condor@stz-bg.com>
Re: Need help with trigger Adrian Klaver <adrian.klaver@aklaver.com>
Re: Need help with trigger Condor <condor@stz-bg.com>
Re: Need help with trigger Adrian Klaver <adrian.klaver@aklaver.com>
Re: Need help with trigger Condor <condor@stz-bg.com>
Re: Need help with trigger Adrian Klaver <adrian.klaver@aklaver.com>
Re: Need help with trigger Melvin Davidson <melvin6925@gmail.com>
Re: Need help with trigger Condor <condor@stz-bg.com>
Re: Need help with trigger "David G. Johnston" <david.g.johnston@gmail.com>
Re: Need help with trigger Condor <condor@stz-bg.com>
On 1/23/21 10:20 AM, Condor wrote:
> On 23-01-2021 18:31, Adrian Klaver wrote:
>> On 1/23/21 4:57 AM, Condor wrote:
>>>
>>>
>>
>> So do an UPDATE and the RETURN NULL to cancel the INSERT. Untested
>> example:
>>
>> UPDATE arhive_table SET sendto = 0, uts = date_part('epoch',
>> CURRENT_TIMESTAMP)::integer WHERE contract = NEW.contract AND service
>> = NEW.service;
>>
>> RETURN NULL;
>>
>
>
> Yep, I think about this update and was my first approach but need to be
> done only if end_date is different.
> If end_date is the same this mean contract still exists so only update
> lastseen column, if the lastseen is not updated other process will read
> not seen contracts and will generate report and send them to delete
> services. If lastseen is changed and sendto is zero again, mean end_date
> is changed and need to be send new end_date again to other systems.
So add an:
ELSIF enddate = FROM NEW.end_date THEN
and do UPDATE of lastseen column.
Honestly I think this better handled by the external program that doing
the transformation.
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления