Re: Hash function for numeric (WIP)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Hash function for numeric (WIP)
Дата
Msg-id 9197.1177661378@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Hash function for numeric (WIP)  (Neil Conway <neilc@samurai.com>)
Ответы Re: Hash function for numeric (WIP)
Re: Hash function for numeric (WIP)
Список pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> For any two numerics that compare equal, we need to compute the same
> hash value for both datums, even if their bit patterns differ.

I feel uncomfortable about this proposal because it will compute
different hashes for values that differ only in having different
numbers of trailing zeroes.  Now the numeric.c code is supposed to
suppress extra trailing zeroes on output, but that's never been a
correctness property ... are we willing to make it one?

There are various related cases involving unstripped leading zeroes.

Another point is that sign = NUMERIC_NAN makes it a NAN regardless
of any other fields; ignoring the sign does not get the right result
here.

Lastly, calling hashint2 seems like overkill, you might as well
just XOR the weight into the digit_hash.

            regards, tom lane

В списке pgsql-patches по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Hash function for numeric (WIP)
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [BUGS] BUG #3245: PANIC: failed to re-find shared lock object