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

Commit73b7912

Browse files
committed
Support * for jsonb_hash_value_ops.
1 parent832649c commit73b7912

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

‎jsonb_gin_ops.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ make_hash_entry_handler(ExtractedNode *node, Pointer extra)
812812
GINKey*key;
813813
KeyExtra*keyExtra;
814814
intresult;
815+
boolpartialMatch= false;
815816

816817
Assert(node->type==eScalar);
817818

@@ -827,11 +828,23 @@ make_hash_entry_handler(ExtractedNode *node, Pointer extra)
827828
if (!node->bounds.inequality)
828829
{
829830
if (node->bounds.exact->type==jqiAny)
830-
return-1;
831-
key=make_gin_query_key(node->bounds.exact,hash);
831+
{
832+
JsQueryValuevalue;
833+
value.jqBase=NULL;
834+
value.jqPos=0;
835+
value.type=jqiNull;
836+
key=make_gin_query_key(&value,hash);
837+
partialMatch= true;
838+
keyExtra->lossy= true;
839+
}
840+
else
841+
{
842+
key=make_gin_query_key(node->bounds.exact,hash);
843+
}
832844
}
833845
else
834846
{
847+
partialMatch= true;
835848
if (node->bounds.leftBound)
836849
{
837850
key=make_gin_query_key(node->bounds.leftBound,hash);
@@ -852,8 +865,7 @@ make_hash_entry_handler(ExtractedNode *node, Pointer extra)
852865
keyExtra->rightBound=NULL;
853866
}
854867
}
855-
result=add_entry(e,PointerGetDatum(key), (Pointer)keyExtra,
856-
node->bounds.inequality);
868+
result=add_entry(e,PointerGetDatum(key), (Pointer)keyExtra,partialMatch);
857869
returnresult;
858870
}
859871

@@ -893,7 +905,11 @@ gin_compare_partial_jsonb_hash_value(PG_FUNCTION_ARGS)
893905
{
894906
KeyExtra*extra_data= (KeyExtra*)PG_GETARG_POINTER(3);
895907

896-
if (extra_data->inequality)
908+
if (extra_data->lossy)
909+
{
910+
result=0;
911+
}
912+
elseif (extra_data->inequality)
897913
{
898914
result=0;
899915
if (!extra_data->leftInclusive&&compare_gin_key_value(key,partial_key) <=0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp