Re: Trigger with conditional predicates

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: Dirk Mika <Dirk(dot)Mika(at)mikatiming(dot)de>
Cc: "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 11:31:09
Message-ID: 47B9A4A8-9A09-4801-989B-AE2C657443DC@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> On 1 Jan 2021, at 16:56, Dirk Mika <Dirk(dot)Mika(at)mikatiming(dot)de> wrote:
>
> Hi all and a happy new Year!
>
> We have an Oracle schema that is to be converted to PostgreSQL, where conditional predicates are used in some triggers.
>
> In particular, columns are populated with values if they are not specified in the update statement which is used.
> Usually with an expression like this:
>
> IF NOT UPDATING('IS_CANCELED')
> THEN
> :new.is_canceled := ...;
> END IF;
>
> I have not found anything similar in PostgreSQL. What is the common approach to this problem?
>
> BR
> Dirk

Can't you use column defaults to handle these cases?

Alban Hertroys
--
There is always an exception to always.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message robert 2021-01-02 11:49:53 Restoring 9.1 db from crashed disk/VM
Previous Message Dirk Mika 2021-01-02 10:23:34 Re: Trigger with conditional predicates