- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit1b4d280
committed
Get rid of the "new" and "old" entries in a view's rangetable.
The rule system needs "old" and/or "new" pseudo-RTEs in rule actionsthat are ON INSERT/UPDATE/DELETE. Historically it's put such entriesinto the ON SELECT rules of views as well, but those are really quitevestigial. The only thing we've used them for is to carry theview's relid forward to AcquireExecutorLocks (so that we canre-lock the view to verify it hasn't changed before re-using a plan)and to carry its relid and permissions data forward to execution-timepermissions checks. What we can do instead of that is to retainthese fields of the RTE_RELATION RTE for the view even after weconvert it to an RTE_SUBQUERY RTE. This requires a tiny amount ofextra complication in the planner and AcquireExecutorLocks, but onthe other hand we can get rid of the logic that moves that data fromone place to another.The principal immediate benefit of doing this, aside from a smallsaving in the pg_rewrite data for views, is that these pseudo-RTEsno longer trigger ruleutils.c's heuristic about qualifying variablenames when the rangetable's length is more than 1. That resultsin quite a number of small simplifications in regression test outputs,which are all to the good IMO.Bump catversion because we need to dump a few more fields ofRTE_SUBQUERY RTEs. While those will always be zeroes anyway instored rules (because we'd never populate them until query rewrite)they are useful for debugging, and it seems like we'd better makesure to transmit such RTEs accurately in plans sent to parallelworkers. I don't think the executor actually examines these fieldsafter startup, but someday it might.Amit LangoteDiscussion:https://postgr.es/m/CA+HiwqEf7gPN4Hn+LoZ4tP2q_Qt7n3vw7-6fJKOf92tSEnX6Gg@mail.gmail.com1 parent2ff5ca8 commit1b4d280
File tree
34 files changed
+774
-890
lines changed- contrib/postgres_fdw/expected
- src
- backend
- commands
- nodes
- optimizer/plan
- parser
- rewrite
- utils/cache
- bin/pg_dump/t
- include
- catalog
- nodes
- test/regress/expected
34 files changed
+774
-890
lines changedLines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2606 | 2606 |
| |
2607 | 2607 |
| |
2608 | 2608 |
| |
2609 |
| - | |
| 2609 | + | |
2610 | 2610 |
| |
2611 | 2611 |
| |
2612 | 2612 |
| |
| |||
2669 | 2669 |
| |
2670 | 2670 |
| |
2671 | 2671 |
| |
2672 |
| - | |
| 2672 | + | |
2673 | 2673 |
| |
2674 | 2674 |
| |
2675 | 2675 |
| |
| |||
6557 | 6557 |
| |
6558 | 6558 |
| |
6559 | 6559 |
| |
6560 |
| - | |
6561 |
| - | |
| 6560 | + | |
| 6561 | + | |
6562 | 6562 |
| |
6563 |
| - | |
| 6563 | + | |
6564 | 6564 |
| |
6565 | 6565 |
| |
6566 | 6566 |
| |
| |||
6674 | 6674 |
| |
6675 | 6675 |
| |
6676 | 6676 |
| |
6677 |
| - | |
6678 |
| - | |
| 6677 | + | |
| 6678 | + | |
6679 | 6679 |
| |
6680 |
| - | |
| 6680 | + | |
6681 | 6681 |
| |
6682 | 6682 |
| |
6683 | 6683 |
| |
|
Lines changed: 0 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
197 |
| - | |
198 |
| - | |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 | 197 |
| |
207 | 198 |
| |
208 | 199 |
| |
|
Lines changed: 0 additions & 107 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
353 | 353 |
| |
354 | 354 |
| |
355 | 355 |
| |
356 |
| - | |
357 |
| - | |
358 |
| - | |
359 |
| - | |
360 |
| - | |
361 |
| - | |
362 |
| - | |
363 |
| - | |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 |
| - | |
370 |
| - | |
371 |
| - | |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 |
| - | |
376 |
| - | |
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 |
| - | |
404 |
| - | |
405 |
| - | |
406 |
| - | |
407 |
| - | |
408 |
| - | |
409 |
| - | |
410 |
| - | |
411 |
| - | |
412 |
| - | |
413 |
| - | |
414 |
| - | |
415 |
| - | |
416 |
| - | |
417 |
| - | |
418 |
| - | |
419 |
| - | |
420 |
| - | |
421 |
| - | |
422 |
| - | |
423 |
| - | |
424 |
| - | |
425 |
| - | |
426 |
| - | |
427 |
| - | |
428 |
| - | |
429 |
| - | |
430 |
| - | |
431 |
| - | |
432 |
| - | |
433 |
| - | |
434 |
| - | |
435 |
| - | |
436 |
| - | |
437 |
| - | |
438 |
| - | |
439 |
| - | |
440 |
| - | |
441 |
| - | |
442 |
| - | |
443 |
| - | |
444 |
| - | |
445 |
| - | |
446 |
| - | |
447 |
| - | |
448 |
| - | |
449 |
| - | |
450 |
| - | |
451 |
| - | |
452 |
| - | |
453 |
| - | |
454 |
| - | |
455 |
| - | |
456 |
| - | |
457 | 356 |
| |
458 | 357 |
| |
459 | 358 |
| |
| |||
616 | 515 |
| |
617 | 516 |
| |
618 | 517 |
| |
619 |
| - | |
620 |
| - | |
621 |
| - | |
622 |
| - | |
623 |
| - | |
624 |
| - | |
625 | 518 |
| |
626 | 519 |
| |
627 | 520 |
| |
|
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
512 | 512 |
| |
513 | 513 |
| |
514 | 514 |
| |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
515 | 519 |
| |
516 | 520 |
| |
517 | 521 |
| |
| |||
545 | 549 |
| |
546 | 550 |
| |
547 | 551 |
| |
548 |
| - | |
549 | 552 |
| |
550 | 553 |
| |
551 | 554 |
| |
| 555 | + | |
| 556 | + | |
552 | 557 |
| |
553 | 558 |
| |
554 | 559 |
| |
|
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
478 | 478 |
| |
479 | 479 |
| |
480 | 480 |
| |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
481 | 485 |
| |
482 | 486 |
| |
483 | 487 |
| |
| |||
520 | 524 |
| |
521 | 525 |
| |
522 | 526 |
| |
523 |
| - | |
524 | 527 |
| |
525 | 528 |
| |
526 | 529 |
| |
| 530 | + | |
| 531 | + | |
527 | 532 |
| |
528 | 533 |
| |
529 | 534 |
| |
|
Lines changed: 14 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
405 | 405 |
| |
406 | 406 |
| |
407 | 407 |
| |
408 |
| - | |
| 408 | + | |
| 409 | + | |
409 | 410 |
| |
410 | 411 |
| |
411 | 412 |
| |
412 | 413 |
| |
413 | 414 |
| |
414 |
| - | |
| 415 | + | |
| 416 | + | |
415 | 417 |
| |
416 | 418 |
| |
417 | 419 |
| |
| |||
501 | 503 |
| |
502 | 504 |
| |
503 | 505 |
| |
504 |
| - | |
505 |
| - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
506 | 509 |
| |
507 | 510 |
| |
508 | 511 |
| |
| |||
560 | 563 |
| |
561 | 564 |
| |
562 | 565 |
| |
563 |
| - | |
| 566 | + | |
| 567 | + | |
564 | 568 |
| |
565 | 569 |
| |
566 | 570 |
| |
| |||
570 | 574 |
| |
571 | 575 |
| |
572 | 576 |
| |
573 |
| - | |
| 577 | + | |
| 578 | + | |
574 | 579 |
| |
575 | 580 |
| |
576 | 581 |
| |
| |||
3403 | 3408 |
| |
3404 | 3409 |
| |
3405 | 3410 |
| |
3406 |
| - | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
3407 | 3414 |
| |
3408 | 3415 |
| |
3409 |
| - | |
3410 |
| - | |
3411 |
| - | |
3412 |
| - | |
3413 |
| - | |
3414 | 3416 |
| |
3415 | 3417 |
| |
3416 | 3418 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3834 | 3834 |
| |
3835 | 3835 |
| |
3836 | 3836 |
| |
3837 |
| - | |
| 3837 | + | |
3838 | 3838 |
| |
3839 | 3839 |
| |
3840 | 3840 |
| |
|
Lines changed: 0 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
633 | 633 |
| |
634 | 634 |
| |
635 | 635 |
| |
636 |
| - | |
637 |
| - | |
638 |
| - | |
639 |
| - | |
640 |
| - | |
641 |
| - | |
642 |
| - | |
643 | 636 |
| |
644 | 637 |
| |
645 | 638 |
| |
|
Lines changed: 12 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1715 | 1715 |
| |
1716 | 1716 |
| |
1717 | 1717 |
| |
1718 |
| - | |
1719 |
| - | |
1720 |
| - | |
1721 |
| - | |
| 1718 | + | |
1722 | 1719 |
| |
1723 | 1720 |
| |
1724 | 1721 |
| |
| |||
1830 | 1827 |
| |
1831 | 1828 |
| |
1832 | 1829 |
| |
1833 |
| - | |
1834 | 1830 |
| |
1835 | 1831 |
| |
1836 | 1832 |
| |
1837 | 1833 |
| |
1838 |
| - | |
1839 |
| - | |
1840 |
| - | |
1841 |
| - | |
1842 |
| - | |
1843 |
| - | |
1844 |
| - | |
1845 | 1834 |
| |
1846 | 1835 |
| |
1847 |
| - | |
1848 |
| - | |
1849 |
| - | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
1850 | 1840 |
| |
1851 |
| - | |
1852 |
| - | |
1853 |
| - | |
1854 |
| - | |
1855 |
| - | |
1856 |
| - | |
1857 |
| - | |
1858 |
| - | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
1859 | 1844 |
| |
1860 | 1845 |
| |
1861 | 1846 |
| |
| |||
1867 | 1852 |
| |
1868 | 1853 |
| |
1869 | 1854 |
| |
1870 |
| - | |
1871 |
| - | |
1872 |
| - | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
1873 | 1859 |
| |
1874 | 1860 |
| |
1875 | 1861 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1769 | 1769 |
| |
1770 | 1770 |
| |
1771 | 1771 |
| |
1772 |
| - | |
| 1772 | + | |
| 1773 | + | |
1773 | 1774 |
| |
1774 | 1775 |
| |
1775 | 1776 |
| |
|
0 commit comments
Comments
(0)