Neil Conway <neilc@samurai.com> writes:
> On Mon, 2007-30-04 at 00:04 -0400, Tom Lane wrote:
>> I'm still not very comfortable with that. You're proposing to add a
>> pretty obvious failure mechanism --- any numeric-returning function
>> that failed to "normalize" its output would now create a subtle,
>> hard-to-find bug.
> What about teaching hash_numeric() to explicitly ignore leading and
> trailing zero digits?
Hm, but apply hash_any() to the remaining digits? That might work, if
you are careful about how you factor the weight into it (or just not try
to use the weight in the hash).
>> Perhaps a suitable test would be to compare the number of
>> hash collisions in a large set of randomly-chosen-but-distinct
>> numeric values.
> Okay, I did a little testing.
> [ test that totally destroys my proposed hash function ]
OK, so *that* idea doesn't work. How about yours above?
regards, tom lane