@@ -315,9 +315,9 @@ gin_triconsistent_jsonb(PG_FUNCTION_ARGS)
315315
316316/*
317317 *
318- * jsonb_hash_ops GIN opclass support functions
318+ * jsonb_path_ops GIN opclass support functions
319319 *
320- * In a jsonb_hash_ops index, the GIN keys are uint32 hashes, one per JSON
320+ * In a jsonb_path_ops index, the GIN keys are uint32 hashes, one per JSON
321321 * value; but the JSON key(s) leading to each value are also included in its
322322 * hash computation. This means we can only support containment queries,
323323 * but the index can distinguish, for example, {"foo": 42} from {"bar": 42}
@@ -326,7 +326,7 @@ gin_triconsistent_jsonb(PG_FUNCTION_ARGS)
326326 */
327327
328328Datum
329- gin_extract_jsonb_hash (PG_FUNCTION_ARGS )
329+ gin_extract_jsonb_path (PG_FUNCTION_ARGS )
330330{
331331 Jsonb * jb = PG_GETARG_JSONB (0 );
332332 int32 * nentries = (int32 * ) PG_GETARG_POINTER (1 );
@@ -349,7 +349,7 @@ gin_extract_jsonb_hash(PG_FUNCTION_ARGS)
349349 /* Otherwise, use 2 * root count as initial estimate of result size */
350350 entries = (Datum * ) palloc (sizeof (Datum ) * total );
351351
352- /* We keep a stack of hashes corresponding to parent key levels */
352+ /* We keep a stack of partial hashes corresponding to parent key levels */
353353 tail .parent = NULL ;
354354 tail .hash = 0 ;
355355 stack = & tail ;
@@ -439,7 +439,7 @@ gin_extract_jsonb_hash(PG_FUNCTION_ARGS)
439439}
440440
441441Datum
442- gin_extract_jsonb_query_hash (PG_FUNCTION_ARGS )
442+ gin_extract_jsonb_query_path (PG_FUNCTION_ARGS )
443443{
444444 int32 * nentries = (int32 * ) PG_GETARG_POINTER (1 );
445445 StrategyNumber strategy = PG_GETARG_UINT16 (2 );
@@ -449,9 +449,9 @@ gin_extract_jsonb_query_hash(PG_FUNCTION_ARGS)
449449 if (strategy != JsonbContainsStrategyNumber )
450450 elog (ERROR , "unrecognized strategy number: %d" , strategy );
451451
452- /* Query is a jsonb, so just apply gin_extract_jsonb_hash ... */
452+ /* Query is a jsonb, so just apply gin_extract_jsonb_path ... */
453453 entries = (Datum * )
454- DatumGetPointer (DirectFunctionCall2 (gin_extract_jsonb_hash ,
454+ DatumGetPointer (DirectFunctionCall2 (gin_extract_jsonb_path ,
455455 PG_GETARG_DATUM (0 ),
456456 PointerGetDatum (nentries )));
457457
@@ -463,7 +463,7 @@ gin_extract_jsonb_query_hash(PG_FUNCTION_ARGS)
463463}
464464
465465Datum
466- gin_consistent_jsonb_hash (PG_FUNCTION_ARGS )
466+ gin_consistent_jsonb_path (PG_FUNCTION_ARGS )
467467{
468468 bool * check = (bool * ) PG_GETARG_POINTER (0 );
469469 StrategyNumber strategy = PG_GETARG_UINT16 (1 );
@@ -480,13 +480,12 @@ gin_consistent_jsonb_hash(PG_FUNCTION_ARGS)
480480 elog (ERROR , "unrecognized strategy number: %d" , strategy );
481481
482482 /*
483- * jsonb_hash_ops is necessarily lossy, not only because of hash
483+ * jsonb_path_ops is necessarily lossy, not only because of hash
484484 * collisions but also because it doesn't preserve complete information
485485 * about the structure of the JSON object. Besides, there are some
486- * special rules around the containment of raw scalar arrays and regular
487- * arrays that are not handled here. So we must always recheck a match.
488- * However, if not all of the keys are present, the tuple certainly
489- * doesn't match.
486+ * special rules around the containment of raw scalars in arrays that are
487+ * not handled here. So we must always recheck a match. However, if not
488+ * all of the keys are present, the tuple certainly doesn't match.
490489 */
491490 * recheck = true;
492491 for (i = 0 ; i < nkeys ; i ++ )
@@ -502,7 +501,7 @@ gin_consistent_jsonb_hash(PG_FUNCTION_ARGS)
502501}
503502
504503Datum
505- gin_triconsistent_jsonb_hash (PG_FUNCTION_ARGS )
504+ gin_triconsistent_jsonb_path (PG_FUNCTION_ARGS )
506505{
507506 GinTernaryValue * check = (GinTernaryValue * ) PG_GETARG_POINTER (0 );
508507 StrategyNumber strategy = PG_GETARG_UINT16 (1 );
0 commit comments