Re: Empty Updates, ON UPDATE triggers and Rules

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Empty Updates, ON UPDATE triggers and Rules
Date: 2009-08-06 18:30:52
Message-ID: 162867790908061130m4a2bfbf1u8445cc4fb0556c49@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2009/8/6 Jeff Davis <pgsql(at)j-davis(dot)com>:
> On Thu, 2009-08-06 at 13:15 -0400, Merlin Moncure wrote:
>> in 8.4 you can (and should) do:
>> WHERE old = new
>
> I couldn't get that to work in a rule.
>
>>   IF NEW != OLD THEN  -- 8.4 syntax
>
> Does this work correctly in the case of NULLs? It looks like it does,
> but that seems strange, because ROW(1, NULL) = ROW(1, NULL) evaluates to
> NULL. Where is this documented?
>

it's not safe, I thing so correct test is

IF NEW IS NOT DISTINCT FROM OLD THEN ...

regards
Pavel Stehule

> Regards,
>        Jeff Davis
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2009-08-06 18:33:57 Re: JOIN a UNION
Previous Message david.schruth 2009-08-06 17:53:05 Re: JOIN a UNION