Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5c80642

Browse files
committed
Remove unnecessary int2vector-specific hash function and equality operator.
These functions were originally added in commitd8cedf6 to supportuse of int2vector columns as catcache lookup keys. However, there areno catcaches that use such columns. (Indeed I now think it must alwayshave been dead code: a catcache with such a key column would need anunderlying unique index on the column, but we've never had an int2vectorbtree opclass.)Getting rid of the int2vector-specific operator and function does notlose any functionality, because operations on int2vectors will now fallback to the generic anyarray support. This avoids a wart that a btreeindex on an int2vector column (made using anyarray_ops) would fail tomatch equality searches, because int2vectoreq wasn't a member of theopclass. We don't really care much about that, since int2vector is notmeant as a type for users to use, but it's silly to have extra code andless 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 beused 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 willbreak any user-created hash indexes on int2vector columns. While hashanyarray_ops would serve the same purpose, it would probably not computethe same hash values and thus wouldn't be on-disk-compatible. Given thatint2vector isn't a user-facing type and we're planning other incompatiblechanges in hash indexes for v10 anyway, this doesn't seem like somethingto worry about, but it's probably worth mentioning here.Amit LangoteDiscussion: <d9bb74f8-b194-7307-9ebd-90645d377e45@lab.ntt.co.jp>
1 parent8518583 commit5c80642

File tree

12 files changed

+1
-41
lines changed

12 files changed

+1
-41
lines changed

‎src/backend/access/hash/hashfunc.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,6 @@ hashoidvector(PG_FUNCTION_ARGS)
130130
returnhash_any((unsignedchar*)key->values,key->dim1*sizeof(Oid));
131131
}
132132

133-
Datum
134-
hashint2vector(PG_FUNCTION_ARGS)
135-
{
136-
int2vector*key= (int2vector*)PG_GETARG_POINTER(0);
137-
138-
returnhash_any((unsignedchar*)key->values,key->dim1*sizeof(int16));
139-
}
140-
141133
Datum
142134
hashname(PG_FUNCTION_ARGS)
143135
{

‎src/backend/utils/adt/int.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,6 @@ int2vectorsend(PG_FUNCTION_ARGS)
254254
returnarray_send(fcinfo);
255255
}
256256

257-
/*
258-
* We don't have a complete set of int2vector support routines,
259-
* but we need int2vectoreq for catcache indexing.
260-
*/
261-
Datum
262-
int2vectoreq(PG_FUNCTION_ARGS)
263-
{
264-
int2vector*a= (int2vector*)PG_GETARG_POINTER(0);
265-
int2vector*b= (int2vector*)PG_GETARG_POINTER(1);
266-
267-
if (a->dim1!=b->dim1)
268-
PG_RETURN_BOOL(false);
269-
PG_RETURN_BOOL(memcmp(a->values,b->values,a->dim1*sizeof(int16))==0);
270-
}
271-
272257

273258
/*****************************************************************************
274259
* PUBLIC ROUTINES *

‎src/backend/utils/cache/catcache.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,6 @@ GetCCHashEqFuncs(Oid keytype, PGFunction *hashfunc, RegProcedure *eqfunc)
126126

127127
*eqfunc=F_INT2EQ;
128128
break;
129-
caseINT2VECTOROID:
130-
*hashfunc=hashint2vector;
131-
132-
*eqfunc=F_INT2VECTOREQ;
133-
break;
134129
caseINT4OID:
135130
*hashfunc=hashint4;
136131

‎src/include/access/hash.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ extern Datum hashenum(PG_FUNCTION_ARGS);
283283
externDatumhashfloat4(PG_FUNCTION_ARGS);
284284
externDatumhashfloat8(PG_FUNCTION_ARGS);
285285
externDatumhashoidvector(PG_FUNCTION_ARGS);
286-
externDatumhashint2vector(PG_FUNCTION_ARGS);
287286
externDatumhashname(PG_FUNCTION_ARGS);
288287
externDatumhashtext(PG_FUNCTION_ARGS);
289288
externDatumhashvarlena(PG_FUNCTION_ARGS);

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201609261
56+
#defineCATALOG_VERSION_NO201610121
5757

5858
#endif

‎src/include/catalog/pg_amop.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,6 @@ DATA(insert (2040 1114 1114 1 s 2060 405 0 ));
573573
DATA(insert (222216161s914050 ));
574574
/* bytea_ops */
575575
DATA(insert (222317171s19554050 ));
576-
/* int2vector_ops */
577-
DATA(insert (222422221s3864050 ));
578576
/* xid_ops */
579577
DATA(insert (222528281s3524050 ));
580578
/* cid_ops */

‎src/include/catalog/pg_amproc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ DATA(insert (2001 1266 1266 1 1696 ));
173173
DATA(insert (20401114111412039 ));
174174
DATA(insert (222216161454 ));
175175
DATA(insert (222317171456 ));
176-
DATA(insert (222422221398 ));
177176
DATA(insert (222528281450 ));
178177
DATA(insert (222629291450 ));
179178
DATA(insert (22277027021450 ));

‎src/include/catalog/pg_opclass.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ DATA(insert (403bpchar_pattern_opsPGNSP PGUID 2097 1042 f 0 ));
168168
DATA(insert (403money_opsPGNSPPGUID2099790t0 ));
169169
DATA(insert (405bool_opsPGNSPPGUID222216t0 ));
170170
DATA(insert (405bytea_opsPGNSPPGUID222317t0 ));
171-
DATA(insert (405int2vector_opsPGNSPPGUID222422t0 ));
172171
DATA(insert (403tid_opsPGNSPPGUID278927t0 ));
173172
DATA(insert (405xid_opsPGNSPPGUID222528t0 ));
174173
DATA(insert (405cid_opsPGNSPPGUID222629t0 ));

‎src/include/catalog/pg_operator.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ DATA(insert OID = 389 ( "!!" PGNSP PGUID l f f 0201700 0 0 numeric_fac
156156
DESCR("deprecated, use ! instead");
157157
DATA(insertOID=385 ("="PGNSPPGUIDbft2929163850cideqeqseleqjoinsel ));
158158
DESCR("equal");
159-
DATA(insertOID=386 ("="PGNSPPGUIDbft2222163860int2vectoreqeqseleqjoinsel ));
160-
DESCR("equal");
161159

162160
DATA(insertOID=387 ("="PGNSPPGUIDbtf272716387402tideqeqseleqjoinsel ));
163161
DESCR("equal");

‎src/include/catalog/pg_opfamily.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ DATA(insert OID = 2099 (403money_opsPGNSP PGUID ));
117117
DATA(insertOID=2222 (405bool_opsPGNSPPGUID ));
118118
#defineBOOL_HASH_FAM_OID 2222
119119
DATA(insertOID=2223 (405bytea_opsPGNSPPGUID ));
120-
DATA(insertOID=2224 (405int2vector_opsPGNSPPGUID ));
121120
DATA(insertOID=2789 (403tid_opsPGNSPPGUID ));
122121
DATA(insertOID=2225 (405xid_opsPGNSPPGUID ));
123122
DATA(insertOID=2226 (405cid_opsPGNSPPGUID ));

‎src/include/catalog/pg_proc.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,6 @@ DATA(insert OID = 313 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 23
540540
DESCR("convert int2 to int4");
541541
DATA(insert OID = 314 ( int2 PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 21"23" _null_ _null_ _null_ _null_ _null_ i4toi2 _null_ _null_ _null_ ));
542542
DESCR("convert int4 to int2");
543-
DATA(insert OID = 315 ( int2vectoreq PGNSP PGUID 12 1 0 0 0 f f f f t f i s 2 0 16 "22 22" _null_ _null_ _null_ _null_ _null_ int2vectoreq _null_ _null_ _null_ ));
544543
DATA(insert OID = 316 ( float8 PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 701 "23" _null_ _null_ _null_ _null_ _null_i4tod _null_ _null_ _null_ ));
545544
DESCR("convert int4 to float8");
546545
DATA(insert OID = 317 ( int4 PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 23 "701" _null_ _null_ _null_ _null_ _null_ dtoi4 _null_ _null_ _null_ ));
@@ -687,8 +686,6 @@ DATA(insert OID = 457 ( hashoidvector PGNSP PGUID 12 1 0 0 0 f f f f t f i s
687686
DESCR("hash");
688687
DATA(insert OID = 329 ( hash_aclitem PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 23 "1033" _null_ _null_ _null_ _null_ _null_hash_aclitem _null_ _null_ _null_ ));
689688
DESCR("hash");
690-
DATA(insert OID = 398 ( hashint2vector PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 23 "22" _null_ _null_ _null_ _null_ _null_ hashint2vector _null_ _null_ _null_ ));
691-
DESCR("hash");
692689
DATA(insert OID = 399 ( hashmacaddr PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 23 "829" _null_ _null_ _null_ _null_ _null_ hashmacaddr _null_ _null_ _null_ ));
693690
DESCR("hash");
694691
DATA(insert OID = 422 ( hashinet PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 23 "869" _null_ _null_ _null_ _null_ _null_ hashinet _null_ _null_ _null_ ));

‎src/include/utils/builtins.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ extern Datum int2vectorin(PG_FUNCTION_ARGS);
192192
externDatumint2vectorout(PG_FUNCTION_ARGS);
193193
externDatumint2vectorrecv(PG_FUNCTION_ARGS);
194194
externDatumint2vectorsend(PG_FUNCTION_ARGS);
195-
externDatumint2vectoreq(PG_FUNCTION_ARGS);
196195
externDatumint4in(PG_FUNCTION_ARGS);
197196
externDatumint4out(PG_FUNCTION_ARGS);
198197
externDatumint4recv(PG_FUNCTION_ARGS);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp