Re: Empty Updates, ON UPDATE triggers and Rules

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: 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:35:29
Message-ID: b42b73150908061135n3dd53b4bp8b728898329258b2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 6, 2009 at 1:38 PM, Jeff Davis<pgsql(at)j-davis(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-08-06 18:43:32 Re: What happens when syslog gets blocked?
Previous Message Pavel Stehule 2009-08-06 18:33:57 Re: JOIN a UNION