Re: Empty Updates, ON UPDATE triggers and Rules - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Empty Updates, ON UPDATE triggers and Rules
Date
Msg-id b42b73150908061135n3dd53b4bp8b728898329258b2@mail.gmail.com
Whole thread Raw
In response to Re: Empty Updates, ON UPDATE triggers and Rules  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-general
On Thu, Aug 6, 2009 at 1:38 PM, Jeff Davis<pgsql@j-davis.com> wrote:
> 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.

it should, maybe try old::foo = new::foo

>>   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?

If you think that's weird, check out:

postgres=# select (50, 0)::foo > (50, null)::foo;
 ?column?
----------
 f
(1 row)

postgres=# select (50, 0)::foo < (50, null)::foo;
 ?column?
----------
 t
(1 row)

I think maybe Pavel is right and is distinct from is safer, but I'd
argue against any change that disallowed comparisons of composites
with nulls in them.

merlin

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: JOIN a UNION
Next
From: Tom Lane
Date:
Subject: Re: What happens when syslog gets blocked?