pgsql: Remove unnecessary int2vector-specific hash function and equalit - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Remove unnecessary int2vector-specific hash function and equalit
Date
Msg-id E1buOfZ-0005Gp-RB@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Remove unnecessary int2vector-specific hash function and equality operator.

These functions were originally added in commit d8cedf67a to support
use of int2vector columns as catcache lookup keys.  However, there are
no catcaches that use such columns.  (Indeed I now think it must always
have been dead code: a catcache with such a key column would need an
underlying unique index on the column, but we've never had an int2vector
btree opclass.)

Getting rid of the int2vector-specific operator and function does not
lose any functionality, because operations on int2vectors will now fall
back to the generic anyarray support.  This avoids a wart that a btree
index on an int2vector column (made using anyarray_ops) would fail to
match equality searches, because int2vectoreq wasn't a member of the
opclass.  We don't really care much about that, since int2vector is not
meant as a type for users to use, but it's silly to have extra code and
less functionality.

If we ever do want a catcache to be indexed by an int2vector column,
we'd need to put back full btree and hash opclasses for int2vector,
comparable to the support for oidvector.  (The anyarray code can't be
used at such a low level, because it needs to do catcache lookups.)
But we'll deal with that if/when the need arises.

Also worth noting is that removal of the hash int2vector_ops opclass will
break any user-created hash indexes on int2vector columns.  While hash
anyarray_ops would serve the same purpose, it would probably not compute
the same hash values and thus wouldn't be on-disk-compatible.  Given that
int2vector isn't a user-facing type and we're planning other incompatible
changes in hash indexes for v10 anyway, this doesn't seem like something
to worry about, but it's probably worth mentioning here.

Amit Langote

Discussion: <d9bb74f8-b194-7307-9ebd-90645d377e45@lab.ntt.co.jp>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5c80642aa8de8393b08cd3cbf612b325cedd98dc

Modified Files
--------------
src/backend/access/hash/hashfunc.c |  8 --------
src/backend/utils/adt/int.c        | 15 ---------------
src/backend/utils/cache/catcache.c |  5 -----
src/include/access/hash.h          |  1 -
src/include/catalog/catversion.h   |  2 +-
src/include/catalog/pg_amop.h      |  2 --
src/include/catalog/pg_amproc.h    |  1 -
src/include/catalog/pg_opclass.h   |  1 -
src/include/catalog/pg_operator.h  |  2 --
src/include/catalog/pg_opfamily.h  |  1 -
src/include/catalog/pg_proc.h      |  3 ---
src/include/utils/builtins.h       |  1 -
12 files changed, 1 insertion(+), 41 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pgsql: Remove pg_dump/pg_dumpall support for dumping from pre-8.0 serve
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Remove pg_dump/pg_dumpall support for dumping from pre-8.0 serve