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

Commit7e74aaf

Browse files
committed
Fix default signature length for gist_ltree_ops
911e702 implemented operator class parameters including the signature lengthin ltree. Previously, the signature length for gist_ltree_ops was 8. Becauseof bug911e702 the default signature length for gist_ltree_ops became 28 forltree 1.1 (where options method is NOT provided) and 8 for ltree 1.2 (whereoptions method is provided). This commit changes the default signature lengthfor ltree 1.1 to 8.Existing gist_ltree_ops indexes might be corrupted in various scenarios.Thus, we have to recommend reindexing all the gist_ltree_ops indexes afterthe upgrade.Reported-by: Victor YegorovReviewed-by: Tomas Vondra, Tom Lane, Andres Freund, Nikita GlukhovReviewed-by: Andrew DunstanAuthor: Tomas Vondra, Alexander KorotkovDiscussion:https://postgr.es/m/17406-71e02820ae79bb40%40postgresql.orgDiscussion:https://postgr.es/m/d80e0a55-6c3e-5b26-53e3-3c4f973f737c%40enterprisedb.com
1 parent46d9bfb commit7e74aaf

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

‎contrib/ltree/ltree.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,13 @@ intltree_strncasecmp(const char *a, const char *b, size_t s);
229229

230230
/* GiST support for ltree */
231231

232-
#defineSIGLEN_MAXGISTMaxIndexKeySize
233-
#defineSIGLEN_DEFAULT(2 * sizeof(int32))
234232
#defineBITBYTE 8
235-
#defineSIGLEN(sizeof(int32) * SIGLENINT)
236233
#defineSIGLENBIT(siglen) ((siglen) * BITBYTE)
234+
#defineLTREE_SIGLEN_DEFAULT(2 * sizeof(int32))
235+
#defineLTREE_SIGLEN_MAXGISTMaxIndexKeySize
236+
#defineLTREE_GET_SIGLEN()(PG_HAS_OPCLASS_OPTIONS() ? \
237+
((LtreeGistOptions *) PG_GET_OPCLASS_OPTIONS())->siglen : \
238+
LTREE_SIGLEN_DEFAULT)
237239

238240
typedefunsignedchar*BITVECP;
239241

‎contrib/ltree/ltree_gist.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ltree_same(PG_FUNCTION_ARGS)
130130
ltree_gist*a= (ltree_gist*)PG_GETARG_POINTER(0);
131131
ltree_gist*b= (ltree_gist*)PG_GETARG_POINTER(1);
132132
bool*result= (bool*)PG_GETARG_POINTER(2);
133-
intsiglen=LTREE_GET_ASIGLEN();
133+
intsiglen=LTREE_GET_SIGLEN();
134134

135135
*result= false;
136136
if (LTG_ISONENODE(a)!=LTG_ISONENODE(b))
@@ -190,7 +190,7 @@ ltree_union(PG_FUNCTION_ARGS)
190190
{
191191
GistEntryVector*entryvec= (GistEntryVector*)PG_GETARG_POINTER(0);
192192
int*size= (int*)PG_GETARG_POINTER(1);
193-
intsiglen=LTREE_GET_ASIGLEN();
193+
intsiglen=LTREE_GET_SIGLEN();
194194
BITVECPbase=palloc0(siglen);
195195
int32i,
196196
j;
@@ -260,7 +260,7 @@ ltree_penalty(PG_FUNCTION_ARGS)
260260
ltree_gist*origval= (ltree_gist*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(0))->key);
261261
ltree_gist*newval= (ltree_gist*)DatumGetPointer(((GISTENTRY*)PG_GETARG_POINTER(1))->key);
262262
float*penalty= (float*)PG_GETARG_POINTER(2);
263-
intsiglen=LTREE_GET_ASIGLEN();
263+
intsiglen=LTREE_GET_SIGLEN();
264264
int32cmpr,
265265
cmpl;
266266

@@ -292,7 +292,7 @@ ltree_picksplit(PG_FUNCTION_ARGS)
292292
{
293293
GistEntryVector*entryvec= (GistEntryVector*)PG_GETARG_POINTER(0);
294294
GIST_SPLITVEC*v= (GIST_SPLITVEC*)PG_GETARG_POINTER(1);
295-
intsiglen=LTREE_GET_ASIGLEN();
295+
intsiglen=LTREE_GET_SIGLEN();
296296
OffsetNumberj;
297297
int32i;
298298
RIX*array;
@@ -618,7 +618,7 @@ ltree_consistent(PG_FUNCTION_ARGS)
618618

619619
/* Oidsubtype = PG_GETARG_OID(3); */
620620
bool*recheck= (bool*)PG_GETARG_POINTER(4);
621-
intsiglen=LTREE_GET_ASIGLEN();
621+
intsiglen=LTREE_GET_SIGLEN();
622622
ltree_gist*key= (ltree_gist*)DatumGetPointer(entry->key);
623623
void*query=NULL;
624624
boolres= false;
@@ -724,7 +724,7 @@ ltree_gist_options(PG_FUNCTION_ARGS)
724724
init_local_reloptions(relopts,sizeof(LtreeGistOptions));
725725
add_local_int_reloption(relopts,"siglen",
726726
"signature length in bytes",
727-
SIGLEN_DEFAULT,1,SIGLEN_MAX,
727+
LTREE_SIGLEN_DEFAULT,1,LTREE_SIGLEN_MAX,
728728
offsetof(LtreeGistOptions,siglen));
729729

730730
PG_RETURN_VOID();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp