- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit66e9df9
committed
Fix some new issues with planning of PlaceHolderVars.
In the wake of commita16ef31, we need to deal with more casesinvolving PlaceHolderVars in NestLoopParams than we did before.For one thing,a16ef31 was incorrect to suppose that we couldrely on the required-outer relids of the lefthand path to decideplacement of nestloop-parameter PHVs. As Richard Guo argued atthe time, we must look at the required-outer relids of the joinpath itself.For another, we have to apply replace_nestloop_params() to sucha PHV's expression, in case it contains references to values thatwill be supplied from NestLoopParams of higher-level nestloops.For another, we need to be more careful about the phnullingrelsof the PHV than we were being. identify_current_nestloop_paramsonly bothered to ensure that the phnullingrels didn't contain"too many" relids, but now it has to be exact, because setrefs.cwill apply both NRM_SUBSET and NRM_SUPERSET checks in differentplaces. We can compute the correct relids by determining theset of outer joins that should be able to null the PHV and thensubtracting whatever's been applied at or below this join.Do the same for plain Vars, too. (This should make it possibleto use NRM_EQUAL to process nestloop params in setrefs.c, butI won't risk making such a change in v18 now.)Lastly, if a nestloop parameter PHV was pulled up out of a subqueryand it contains a subquery that was originally pushed down from thisquery level, then that will still be represented as a SubLink, becauseSS_process_sublinks won't recurse into outer PHVs, so it didn't gettransformed during expression preprocessing in the subquery. We cansubstitute the version of the PHV's expression appearing in itsPlaceHolderInfo to ensure that that preprocessing has happened.(Seems like this processing sequence could stand to be redesigned,but again, late in v18 development is not the time for that.)It's not very clear to me why the old have_dangerous_phv join-orderrestriction prevented us from seeing the last three of these problems.But given the lack of field complaints, it must have done so.Reported-by: Alexander Lakhin <exclusion@gmail.com>Author: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/18953-1c9883a9d4afeb30@postgresql.org1 parent8319e5c commit66e9df9
File tree
7 files changed
+330
-37
lines changed- src
- backend/optimizer
- plan
- util
- include/optimizer
- test/regress
- expected
- sql
7 files changed
+330
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4344 | 4344 | | |
4345 | 4345 | | |
4346 | 4346 | | |
| 4347 | + | |
4347 | 4348 | | |
4348 | 4349 | | |
4349 | 4350 | | |
| |||
4374 | 4375 | | |
4375 | 4376 | | |
4376 | 4377 | | |
4377 | | - | |
4378 | | - | |
| 4378 | + | |
| 4379 | + | |
4379 | 4380 | | |
4380 | 4381 | | |
4381 | 4382 | | |
| |||
4415 | 4416 | | |
4416 | 4417 | | |
4417 | 4418 | | |
4418 | | - | |
| 4419 | + | |
| 4420 | + | |
4419 | 4421 | | |
4420 | 4422 | | |
4421 | 4423 | | |
4422 | 4424 | | |
4423 | 4425 | | |
4424 | 4426 | | |
4425 | 4427 | | |
| 4428 | + | |
| 4429 | + | |
| 4430 | + | |
| 4431 | + | |
4426 | 4432 | | |
4427 | 4433 | | |
4428 | 4434 | | |
4429 | 4435 | | |
4430 | 4436 | | |
4431 | 4437 | | |
| 4438 | + | |
4432 | 4439 | | |
4433 | 4440 | | |
4434 | 4441 | | |
4435 | 4442 | | |
4436 | | - | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + | |
| 4446 | + | |
4437 | 4447 | | |
4438 | 4448 | | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
| 4458 | + | |
| 4459 | + | |
4439 | 4460 | | |
4440 | 4461 | | |
4441 | 4462 | | |
4442 | 4463 | | |
4443 | | - | |
| 4464 | + | |
4444 | 4465 | | |
4445 | 4466 | | |
4446 | 4467 | | |
4447 | 4468 | | |
4448 | 4469 | | |
4449 | 4470 | | |
4450 | | - | |
4451 | | - | |
| 4471 | + | |
4452 | 4472 | | |
4453 | 4473 | | |
4454 | 4474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
602 | | - | |
603 | | - | |
604 | | - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
605 | 606 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
625 | 618 | | |
626 | 619 | | |
627 | 620 | | |
628 | 621 | | |
629 | | - | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
630 | 625 | | |
631 | 626 | | |
632 | | - | |
633 | | - | |
634 | 627 | | |
635 | 628 | | |
636 | 629 | | |
| |||
661 | 654 | | |
662 | 655 | | |
663 | 656 | | |
| 657 | + | |
664 | 658 | | |
665 | 659 | | |
666 | 660 | | |
667 | | - | |
| 661 | + | |
668 | 662 | | |
669 | 663 | | |
670 | 664 | | |
671 | 665 | | |
672 | 666 | | |
673 | 667 | | |
674 | | - | |
| 668 | + | |
| 669 | + | |
675 | 670 | | |
676 | 671 | | |
677 | 672 | | |
678 | 673 | | |
679 | 674 | | |
680 | 675 | | |
681 | | - | |
682 | | - | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
683 | 709 | | |
684 | 710 | | |
685 | 711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
0 commit comments
Comments
(0)