Re: is this a bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: is this a bug?
Date: 2010-01-17 23:47:00
Message-ID: 14173.1263772020@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis <pgsql(at)j-davis(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2010-01-17 23:52:11 Re: Clearing global statistics
Previous Message Tom Lane 2010-01-17 23:25:34 Re: parallel regression test output