Re: Trigger with conditional predicates

From: Dirk Mika <Dirk(dot)Mika(at)mikatiming(dot)de>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Trigger with conditional predicates
Date: 2021-01-02 10:17:55
Message-ID: 9CB1A2F2-1B40-4B14-AF71-8DC129B806A0@mikatiming.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> > PostgreSQL doesn't have an exact equivalent. Typically, the OLD and NEW values are compared and then action is taken based on that. For example, in PL/pgSQL:
> > IF NEW.is_canceled IS NOT DISTINCT FROM OLD.is_canceled THEN
> > NEW.is_canceled := etc etc ;
> > ENDIF;
> > There's currently no way to detect if the column was simply not mentioned at all in the UPDATE statement.
>
> That's not completely true: you can make the whole trigger firing
> dependent on that, by writing something like
>
> CREATE TRIGGER tgname BEFORE UPDATE OF column_name [, ... ] ON table ...
>
> and then the trigger won't fire if the column is not mentioned.

Well, this works if I've something like

IF UPDATING(...) THEN

But since I've

IF NOT UPDATING(...) THEN

This isn't working. Or am I missing something?

BR
Dirk

--
Dirk Mika
Software Developer

mika:timing GmbH
Strundepark - Kürtener Str. 11b
51465 Bergisch Gladbach
Germany

fon +49 2202 2401-1197
dirk(dot)mika(at)mikatiming(dot)de
www.mikatiming.de

AG Köln HRB 47509 * WEEE-Reg.-Nr. DE 90029884
Geschäftsführer: Harald Mika, Jörg Mika

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dirk Mika 2021-01-02 10:23:34 Re: Trigger with conditional predicates
Previous Message Tom Lane 2021-01-01 17:30:10 Re: Btree vs. GIN