Commit 3f15bfc
committed
[yugabyte#2272] YSQL: Creating system views during YSQL cluster upgrade
Summary:
Support `CREATE VIEW` during YSQL upgrade imitating the behaviour of `yb_system_views.sql` processing by initdb.
This has two key differences with `CREATE TABLE`:
* View is defined through a rewrite rule (entry in `pg_rewrite`), which has its own OID allocated in [10000, 16384) range (from `FirstBootstrapObjectId` until `FirstNormalObjectId`). To specify it, new reloption `rewrite_rule_oid` was introduced.
* Since it's an SQL script and not BKI definition, reloptions can now be specified and persisted. As such, temporary helper options `table_oid`, `row_type_oid` and `rewrite_rule_oid` are removed before persisting.
Additionally, `yb_non_ddl_txn_for_sys_tables_allowed` development flag caused `CREATE VIEW` to fail with a read restart error because cache refresh operation was done in the wrong transaction. Changed it to affect WRITE operations only.
Test Plan: ybd --java-test org.yb.pgsql.TestYsqlUpgrade
Reviewers: dmitry, mihnea, jason
Reviewed By: jason
Subscribers: zyu, yql
Differential Revision: https://phabricator.dev.yugabyte.com/D121281 parent 33ca6e2 commit 3f15bfc
File tree
14 files changed
+308
-31
lines changed- java/yb-pgsql/src/test/java/org/yb/pgsql
- src
- postgres/src
- backend
- access/common
- catalog
- commands
- rewrite
- include
- access
- catalog
- commands
- rewrite
- utils
- yb/yql/pggate
14 files changed
+308
-31
lines changedLines changed: 102 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
441 | 532 | | |
442 | 533 | | |
443 | 534 | | |
| |||
487 | 578 | | |
488 | 579 | | |
489 | 580 | | |
| 581 | + | |
490 | 582 | | |
491 | 583 | | |
492 | 584 | | |
| |||
498 | 590 | | |
499 | 591 | | |
500 | 592 | | |
501 | | - | |
502 | | - | |
| 593 | + | |
| 594 | + | |
503 | 595 | | |
504 | 596 | | |
505 | 597 | | |
| |||
690 | 782 | | |
691 | 783 | | |
692 | 784 | | |
| 785 | + | |
| 786 | + | |
693 | 787 | | |
694 | 788 | | |
695 | 789 | | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
696 | 795 | | |
697 | 796 | | |
698 | 797 | | |
| 798 | + | |
699 | 799 | | |
700 | 800 | | |
701 | 801 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
395 | 406 | | |
396 | 407 | | |
397 | 408 | | |
| |||
827 | 838 | | |
828 | 839 | | |
829 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
830 | 859 | | |
831 | 860 | | |
832 | 861 | | |
| |||
940 | 969 | | |
941 | 970 | | |
942 | 971 | | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
943 | 978 | | |
944 | 979 | | |
945 | 980 | | |
| |||
1475 | 1510 | | |
1476 | 1511 | | |
1477 | 1512 | | |
1478 | | - | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
1479 | 1516 | | |
1480 | 1517 | | |
1481 | 1518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
693 | 694 | | |
694 | 695 | | |
695 | 696 | | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1206 | 1206 | | |
1207 | 1207 | | |
1208 | 1208 | | |
| 1209 | + | |
| 1210 | + | |
1209 | 1211 | | |
1210 | 1212 | | |
1211 | | - | |
| 1213 | + | |
| 1214 | + | |
1212 | 1215 | | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
1216 | 1223 | | |
1217 | | - | |
| 1224 | + | |
| 1225 | + | |
1218 | 1226 | | |
1219 | | - | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
1220 | 1232 | | |
1221 | 1233 | | |
1222 | 1234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
661 | 665 | | |
662 | 666 | | |
663 | 667 | | |
| |||
692 | 696 | | |
693 | 697 | | |
694 | 698 | | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | 699 | | |
701 | 700 | | |
702 | 701 | | |
| |||
758 | 757 | | |
759 | 758 | | |
760 | 759 | | |
761 | | - | |
762 | | - | |
| 760 | + | |
| 761 | + | |
763 | 762 | | |
764 | 763 | | |
765 | 764 | | |
| |||
0 commit comments