mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Fix bug introduced by last patch, thanks again to Mario Weilguni <mweilguni@sime.com>
This commit is contained in:
parent
3da93a0a3b
commit
2b3d2717c4
@ -454,16 +454,36 @@ gist_isparent(ltree_gist * key, ltree * query)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ltree *
|
||||||
|
copy_ltree( ltree *src ) {
|
||||||
|
ltree *dst = (ltree*)palloc(src->len);
|
||||||
|
memcpy(dst, src, src->len);
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gist_ischild(ltree_gist * key, ltree * query)
|
gist_ischild(ltree_gist * key, ltree * query)
|
||||||
{
|
{
|
||||||
if (ltree_compare(query, LTG_GETLNODE(key)) < 0)
|
ltree *left = copy_ltree(LTG_GETLNODE(key));
|
||||||
return false;
|
ltree *right = copy_ltree(LTG_GETRNODE(key));
|
||||||
|
bool res = true;
|
||||||
|
|
||||||
if (ltree_compare(query, LTG_GETRNODE(key)) > 0)
|
if (left->numlevel > query->numlevel)
|
||||||
return false;
|
left->numlevel = query->numlevel;
|
||||||
|
|
||||||
return true;
|
if (ltree_compare(query, left) < 0)
|
||||||
|
res = false;
|
||||||
|
|
||||||
|
if (right->numlevel > query->numlevel)
|
||||||
|
right->numlevel = query->numlevel;
|
||||||
|
|
||||||
|
if (res && ltree_compare(query, right) > 0)
|
||||||
|
res = false;
|
||||||
|
|
||||||
|
pfree(left);
|
||||||
|
pfree(right);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user