David Rowley <dgrowleyml@gmail.com> writes:
> I've attached a version that "probes" the equality function for its
> NULL = NULL behaviour and its NULL = non-NULL behaviour and returns
> whatever the result of the probe was at the appropriate time.
> What I came up with does feel quite elaborate, so I'd quite like a 2nd opinion.
> The patch does assume that the non-strict function will return the
> same thing for NULL = non-NULL as it will for non-NULL = NULL.
Meh. I think we assume that hashable equality functions satisfy the
symmetric law, ie A = B if and only if B = A, so that part is fine.
However, I do not care for the assumption that any random non-null
input will produce the same answer. As a quick counter-example,
consider a text-like datatype that tries to emulate Oracle's semantics
that an empty string is the same as NULL. Your code would arrive at
different results depending on whether the first non-null input
chanced to be an empty string.
(I've not read this whole thread, so I don't have a global opinion
on what we ought to do here. I suspect it's a tricky subject.)
regards, tom lane