From: Alban Hertroys <haramrae@gmail.com>
To: Dirk Mika <Dirk.Mika@mikatiming.de>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Trigger with conditional predicates
Date: Sat, 2 Jan 2021 12:31:09 +0100
Message-ID: <47B9A4A8-9A09-4801-989B-AE2C657443DC@gmail.com> (raw)
In-Reply-To: <A4A3D4D4-B8C9-4ED2-B10D-0A908D639F99@mikatiming.de>
References: <A4A3D4D4-B8C9-4ED2-B10D-0A908D639F99@mikatiming.de>
> On 1 Jan 2021, at 16:56, Dirk Mika <Dirk.Mika@mikatiming.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: haramrae@gmail.com, Dirk.Mika@mikatiming.de
Subject: Re: Trigger with conditional predicates
In-Reply-To: <47B9A4A8-9A09-4801-989B-AE2C657443DC@gmail.com>
References: <A4A3D4D4-B8C9-4ED2-B10D-0A908D639F99@mikatiming.de> <47B9A4A8-9A09-4801-989B-AE2C657443DC@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox