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

Commit00dc303

Browse files
committed
log_gin_key function
1 parentfaae0df commit00dc303

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

‎jsonb_ops.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,46 @@ get_path_bloom(PathHashStack *stack)
681681
returnres;
682682
}
683683

684+
staticvoid
685+
log_gin_key(GINKey*key)
686+
{
687+
if (GINKeyType(key)==jbvNull)
688+
{
689+
elog(NOTICE,"hash = %X, NULL",key->hash);
690+
}
691+
elseif (GINKeyType(key)==jbvBool)
692+
{
693+
if (GINKeyIsTrue(key))
694+
elog(NOTICE,"hash = %X, true",key->hash);
695+
else
696+
elog(NOTICE,"hash = %X, false",key->hash);
697+
}
698+
elseif (GINKeyType(key)==jbvNumeric)
699+
{
700+
if (GINKeyIsTrue(key))
701+
{
702+
elog(NOTICE,"hash = %X, -inf",key->hash);
703+
}
704+
else
705+
{
706+
char*s;
707+
s=DatumGetCString(DirectFunctionCall1(numeric_out,PointerGetDatum(GINKeyDataNumeric(key))));
708+
elog(NOTICE,"hash = %X, \"%s\"",key->hash,s);
709+
}
710+
}
711+
elseif (GINKeyType(key)==jbvString)
712+
{
713+
char*s= (char*)palloc(GINKeyStringLen(key)+1);
714+
s[GINKeyStringLen(key)]='\0';
715+
memcpy(s,GINKeyDataString(key),GINKeyStringLen(key));
716+
elog(NOTICE,"hash = %X, \"%s\"",key->hash,s);
717+
}
718+
else
719+
{
720+
elog(ERROR,"GINKey must be scalar");
721+
}
722+
}
723+
684724
staticGINKey*
685725
make_gin_key(JsonbValue*v,uint32hash)
686726
{
@@ -768,6 +808,7 @@ make_gin_query_key_minus_inf(uint32 hash)
768808

769809
key= (GINKey*)palloc(GINKEYLEN);
770810
key->type=jbvNumeric |GINKeyTrue;
811+
key->hash=hash;
771812
SET_VARSIZE(key,GINKEYLEN);
772813
returnkey;
773814
}
@@ -843,6 +884,9 @@ gin_compare_partial_jsonb_bloom_value(PG_FUNCTION_ARGS)
843884
StrategyNumberstrategy=PG_GETARG_UINT16(2);
844885
int32result;
845886

887+
/*log_gin_key(partial_key);
888+
log_gin_key(key);*/
889+
846890
if (strategy==JsQueryMatchStrategyNumber)
847891
{
848892
KeyExtra*extra_data= (KeyExtra*)PG_GETARG_POINTER(3);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp