Skip site navigation (1) Skip section navigation (2)

pgsql: Add a hash function for "numeric".

From: neilc(at)postgresql(dot)org (Neil Conway)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add a hash function for "numeric".
Date: 2007-05-08 18:56:48
Message-ID: 20070508185648.DEB199FBC3F@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/src/backend/utils/adt:
        numeric.c (r1.101 -> r1.102)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/numeric.c.diff?r1=1.101&r2=1.102)
    pgsql/src/include/catalog:
        catversion.h (r1.404 -> r1.405)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h.diff?r1=1.404&r2=1.405)
        pg_amop.h (r1.80 -> r1.81)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_amop.h.diff?r1=1.80&r2=1.81)
        pg_amproc.h (r1.64 -> r1.65)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_amproc.h.diff?r1=1.64&r2=1.65)
        pg_opclass.h (r1.75 -> r1.76)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_opclass.h.diff?r1=1.75&r2=1.76)
        pg_operator.h (r1.151 -> r1.152)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_operator.h.diff?r1=1.151&r2=1.152)
        pg_opfamily.h (r1.4 -> r1.5)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_opfamily.h.diff?r1=1.4&r2=1.5)
        pg_proc.h (r1.454 -> r1.455)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h.diff?r1=1.454&r2=1.455)
    pgsql/src/include/utils:
        builtins.h (r1.291 -> r1.292)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/builtins.h.diff?r1=1.291&r2=1.292)

pgsql-committers by date

Next:From: Tom LaneDate: 2007-05-08 19:13:52
Subject: pgsql: Reserve some pg_statistic "kind" codes for use by the ESRI
Previous:From: User Cunha17Date: 2007-05-08 17:10:18
Subject: snapshot - drivers: Missing BASE_SCHEMA placeholder

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group