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