diff options
author | Neil Conway <neilc@samurai.com> | 2007-05-08 18:56:48 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2007-05-08 18:56:48 +0000 |
commit | ade493e02d25f4807c02dcd763a25d4232b3b68d (patch) | |
tree | a234ff952a89a742ceb5b668adc31fc0e0ddbbda /src/include/utils/builtins.h | |
parent | 97f796942fe529ed080a6b1695ec00fa19dfb191 (diff) | |
download | postgresql-ade493e02d25f4807c02dcd763a25d4232b3b68d.tar.gz postgresql-ade493e02d25f4807c02dcd763a25d4232b3b68d.zip |
Add a hash function for "numeric". Mark the equality operator for
numerics as "oprcanhash", and make the corresponding system catalog
updates. As a result, hash indexes, hashed aggregation, and hash
joins can now be used with the numeric type. Bump the catversion.
The only tricky aspect to doing this is writing a correct hash
function: it's possible for two Numerics to be equal according to
their equality operator, but have different in-memory bit patterns.
To cope with this, the hash function doesn't consider the Numeric's
"scale" or "sign", and explictly skips any leading or trailing
zeros in the Numeric's digit buffer (the current implementation
should suppress any such zeros, but it seems unwise to rely upon
this). See discussion on pgsql-patches for more details.
Diffstat (limited to 'src/include/utils/builtins.h')
-rw-r--r-- | src/include/utils/builtins.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index d93599a9ae5..22b10841c6a 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.291 2007/04/02 03:49:41 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/builtins.h,v 1.292 2007/05/08 18:56:48 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -883,6 +883,7 @@ extern Datum int2_avg_accum(PG_FUNCTION_ARGS); extern Datum int4_avg_accum(PG_FUNCTION_ARGS); extern Datum int8_avg(PG_FUNCTION_ARGS); extern Datum width_bucket_numeric(PG_FUNCTION_ARGS); +extern Datum hash_numeric(PG_FUNCTION_ARGS); /* ri_triggers.c */ extern Datum RI_FKey_check_ins(PG_FUNCTION_ARGS); |