| 459 | } |
| 460 | |
| 461 | Datum |
| 462 | g_intbig_consistent(PG_FUNCTION_ARGS) |
| 463 | { |
| 464 | GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); |
| 465 | ArrayType *query = PG_GETARG_ARRAYTYPE_P(1); |
| 466 | StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); |
| 467 | |
| 468 | /* Oid subtype = PG_GETARG_OID(3); */ |
| 469 | bool *recheck = (bool *) PG_GETARG_POINTER(4); |
| 470 | int siglen = GET_SIGLEN(); |
| 471 | bool retval; |
| 472 | |
| 473 | /* All cases served by this function are inexact */ |
| 474 | *recheck = true; |
| 475 | |
| 476 | if (ISALLTRUE(DatumGetPointer(entry->key))) |
| 477 | PG_RETURN_BOOL(true); |
| 478 | |
| 479 | if (strategy == BooleanSearchStrategy) |
| 480 | { |
| 481 | retval = signconsistent((QUERYTYPE *) query, |
| 482 | GETSIGN(DatumGetPointer(entry->key)), |
| 483 | siglen, |
| 484 | false); |
| 485 | PG_FREE_IF_COPY(query, 1); |
| 486 | PG_RETURN_BOOL(retval); |
| 487 | } |
| 488 | |
| 489 | CHECKARRVALID(query); |
| 490 | |
| 491 | switch (strategy) |
| 492 | { |
| 493 | case RTOverlapStrategyNumber: |
| 494 | retval = _intbig_overlap((GISTTYPE *) DatumGetPointer(entry->key), |
| 495 | query, siglen); |
| 496 | break; |
| 497 | case RTSameStrategyNumber: |
| 498 | if (GIST_LEAF(entry)) |
| 499 | { |
| 500 | int i, |
| 501 | num = ARRNELEMS(query); |
| 502 | int32 *ptr = ARRPTR(query); |
| 503 | BITVECP dq = palloc0(siglen), |
| 504 | de; |
| 505 | |
| 506 | while (num--) |
| 507 | { |
| 508 | HASH(dq, *ptr, siglen); |
| 509 | ptr++; |
| 510 | } |
| 511 | |
| 512 | de = GETSIGN((GISTTYPE *) DatumGetPointer(entry->key)); |
| 513 | retval = true; |
| 514 | LOOPBYTE(siglen) |
| 515 | { |
| 516 | if (de[i] != dq[i]) |
| 517 | { |
| 518 | retval = false; |
nothing calls this directly
no test coverage detected