forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb23af45
committed
Fix erroneous hash calculations in gin_extract_jsonb_path().
The jsonb_path_ops code calculated hash values inconsistently in some casesinvolving nested arrays and objects. This would result in queries possiblynot finding entries that they should find, when using a jsonb_path_ops GINindex for the search. The problem cases involve JSONB values that containboth scalars and sub-objects at the same nesting level, for example anarray containing both scalars and sub-arrays. To fix, reset the currentstack->hash after processing each value or sub-object, not before; anddon't try to be cute about the outermost level's initial hash.Correcting this means that existing jsonb_path_ops indexes may now beinconsistent with the new hash calculation code. The symptom is the same--- searches not finding entries they should find --- but the specificrows affected are likely to be different. Users will need to REINDEXjsonb_path_ops indexes to make sure that all searches work as expected.Per bug #13756 from Daniel Cheng. Back-patch to 9.4 where the faultylogic was introduced.1 parent8c75ad4 commitb23af45
File tree
3 files changed
+88
-33
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+88
-33
lines changedLines changed: 18 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
375 | 375 |
| |
376 | 376 |
| |
377 | 377 |
| |
378 |
| - | |
379 |
| - | |
380 |
| - | |
381 |
| - | |
382 |
| - | |
383 |
| - | |
384 |
| - | |
385 |
| - | |
386 |
| - | |
387 |
| - | |
388 |
| - | |
389 |
| - | |
390 |
| - | |
391 |
| - | |
392 |
| - | |
393 |
| - | |
394 |
| - | |
395 |
| - | |
396 |
| - | |
397 |
| - | |
398 |
| - | |
399 |
| - | |
400 |
| - | |
401 |
| - | |
402 |
| - | |
403 |
| - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
404 | 388 |
| |
405 | 389 |
| |
406 | 390 |
| |
407 |
| - | |
408 |
| - | |
409 |
| - | |
| 391 | + | |
410 | 392 |
| |
411 | 393 |
| |
412 | 394 |
| |
413 | 395 |
| |
414 |
| - | |
415 |
| - | |
416 |
| - | |
417 | 396 |
| |
418 | 397 |
| |
419 | 398 |
| |
420 | 399 |
| |
421 | 400 |
| |
422 |
| - | |
| 401 | + | |
| 402 | + | |
423 | 403 |
| |
424 | 404 |
| |
425 | 405 |
| |
426 | 406 |
| |
427 | 407 |
| |
428 | 408 |
| |
429 | 409 |
| |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
430 | 415 |
| |
431 | 416 |
| |
432 | 417 |
| |
|
Lines changed: 50 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2420 | 2420 |
| |
2421 | 2421 |
| |
2422 | 2422 |
| |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
2423 | 2473 |
| |
2424 | 2474 |
| |
2425 | 2475 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
618 | 618 |
| |
619 | 619 |
| |
620 | 620 |
| |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
621 | 641 |
| |
622 | 642 |
| |
623 | 643 |
| |
|
0 commit comments
Comments
(0)