Re: INSERT Trigger to check for existing records

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Hagen Finley <hagen(at)datasundae(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: INSERT Trigger to check for existing records
Date: 2020-11-21 16:47:03
Message-ID: 212448c5-e86b-46df-53d6-0149a0abf68e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/21/20 8:20 AM, Adrian Klaver wrote:
> On 11/21/20 8:00 AM, Hagen Finley wrote:
>> Hello,

>
> Instead:
>
> IF NEW.ndealid = OLD.ndealid AND NEW.revusd = OLD.revusd
>         AND NEW.stage = OLD.stage THEN
>     RETURN NULL; --Will cancel INSERT
> ELSE
>     RETURN NEW;
>
> END IF;

Well this is what happens when I answer BC(before coffee). The above
will not work, if for no other reason then OLD does not exist in an
INSERT. Will try to come up with something that is in the realm of
possibility.

>
>>
>> Hagen
>>
>> Larimer County, CO
>>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-11-21 17:11:25 Re: INSERT Trigger to check for existing records
Previous Message Adrian Klaver 2020-11-21 16:20:43 Re: INSERT Trigger to check for existing records