Re: is this a bug? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: is this a bug?
Date
Msg-id 14173.1263772020@sss.pgh.pa.us
Whole thread Raw
In response to is this a bug?  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: is this a bug?  (Jeff Davis <pgsql@j-davis.com>)
Re: is this a bug?  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
Jeff Davis <pgsql@j-davis.com> writes:
>   create type y as (c char, n int);
>   select ('a', NULL)::y = ('a', NULL)::y; -- TRUE 
>   select ('a', NULL) = ('a', NULL); -- NULL

> I would expect those to evaluate to the same thing.

The latter gets simplified to ('a' = 'a') AND (NULL = NULL).
The former doesn't --- it goes through record_eq, which treats
two nulls as equal.

The reason record_eq does that is that we have to have a total ordering
in order for record types to be indexable or sortable.

The former might be closer to the spec's expectations but I'm not
totally sure about it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: parallel regression test output
Next
From: Greg Smith
Date:
Subject: Re: Clearing global statistics