There is currently no support for hashing numerics. This prevents
numerics from being hash indexed or used in a hashed aggregation. This
patch makes the necessary changes to the catalogs to enable hashing for
numerics, and implements a first sketch at a hash function for numerics.
For any two numerics that compare equal, we need to compute the same
hash value for both datums, even if their bit patterns differ. This
patch computes the hash from the "n_weight" and "n_data" fields of the
numeric -- notably, it doesn't use the numeric's "scale" field, since
two equal numerics may have different scales. The hash seems to return
the correct results for the simple test cases that I've tried, but I'm
not very familiar with the details of the numeric implementation -- can
anyone comment on whether this hash function is correct?
Thanks to Sailesh Krishnamurthy for reporting this problem.
pgsql-patches by date
|Next:||From: Simon Riggs||Date: 2007-04-27 08:05:38|
|Subject: Re: [PATCHES] Reviewers Guide to DeferredTransactions/TransactionGuarantee|
|Previous:||From: Zoltan Boszormenyi||Date: 2007-04-27 06:08:14|
|Subject: Re: New version of GENERATED/IDENTITY, was Re: parser dilemma|