- Notifications
You must be signed in to change notification settings - Fork28
Commit5815696
committed
Make parser rely more heavily on the ParseNamespaceItem data structure.
When I added the ParseNamespaceItem data structure (in commit5ebaaa4),it wasn't very tightly integrated into the parser's APIs. In the wake ofadding p_rtindex to that struct (commitb541e9a), there is a good reasonto make more use of it: by passing around ParseNamespaceItem pointersinstead of bare RTE pointers, we can get rid of various messy methods forpassing back or deducing the rangetable index of an RTE during parsing.Hence, refactor the addRangeTableEntryXXX functions to build and returna ParseNamespaceItem struct, not just the RTE proper; and replaceaddRTEtoQuery with addNSItemToQuery, which is passed a ParseNamespaceItemrather than building one internally.Also, add per-column data (a ParseNamespaceColumn array) to eachParseNamespaceItem. These arrays are built during addRangeTableEntryXXX,where we have column type data at hand so that it's nearly free to fillthe data structure. Later, when we need to build Vars referencing RTEs,we can use the ParseNamespaceColumn info to avoid the rather expensiveoperations done in get_rte_attribute_type() or expandRTE().get_rte_attribute_type() is indeed dead code now, so I've removed it.This makes for a useful improvement in parse analysis speed, around 20%in one moderately-complex test query.The ParseNamespaceColumn structs also include Var identity information(varno/varattno). That info isn't actually being used in this patch,except that p_varno == 0 is a handy test for a dropped column.A follow-on patch will make more use of it.Discussion:https://postgr.es/m/2461.1577764221@sss.pgh.pa.us1 parent198c715 commit5815696
File tree
20 files changed
+927
-794
lines changed- src
- backend
- catalog
- commands
- optimizer/plan
- parser
- replication/logical
- rewrite
- include/parser
- test/modules/test_rls_hooks
20 files changed
+927
-794
lines changedLines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2531 | 2531 |
| |
2532 | 2532 |
| |
2533 | 2533 |
| |
2534 |
| - | |
| 2534 | + | |
2535 | 2535 |
| |
2536 | 2536 |
| |
2537 | 2537 |
| |
| |||
2554 | 2554 |
| |
2555 | 2555 |
| |
2556 | 2556 |
| |
2557 |
| - | |
2558 |
| - | |
2559 |
| - | |
2560 |
| - | |
2561 |
| - | |
2562 |
| - | |
2563 |
| - | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
2564 | 2564 |
| |
2565 | 2565 |
| |
2566 | 2566 |
| |
|
Lines changed: 6 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
882 | 882 |
| |
883 | 883 |
| |
884 | 884 |
| |
| 885 | + | |
885 | 886 |
| |
886 | 887 |
| |
887 | 888 |
| |
| |||
894 | 895 |
| |
895 | 896 |
| |
896 | 897 |
| |
897 |
| - | |
898 |
| - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
899 | 901 |
| |
900 | 902 |
| |
901 | 903 |
| |
902 | 904 |
| |
903 |
| - | |
904 |
| - | |
| 905 | + | |
| 906 | + | |
905 | 907 |
| |
906 | 908 |
| |
907 | 909 |
| |
|
Lines changed: 32 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
568 | 568 |
| |
569 | 569 |
| |
570 | 570 |
| |
571 |
| - | |
572 |
| - | |
573 |
| - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
574 | 574 |
| |
575 | 575 |
| |
576 | 576 |
| |
| |||
592 | 592 |
| |
593 | 593 |
| |
594 | 594 |
| |
595 |
| - | |
596 |
| - | |
597 |
| - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
598 | 598 |
| |
599 | 599 |
| |
600 | 600 |
| |
| |||
699 | 699 |
| |
700 | 700 |
| |
701 | 701 |
| |
702 |
| - | |
| 702 | + | |
703 | 703 |
| |
704 | 704 |
| |
705 | 705 |
| |
| |||
755 | 755 |
| |
756 | 756 |
| |
757 | 757 |
| |
758 |
| - | |
759 |
| - | |
760 |
| - | |
761 |
| - | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
762 | 762 |
| |
763 | 763 |
| |
764 |
| - | |
765 |
| - | |
766 |
| - | |
767 |
| - | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
768 | 768 |
| |
769 | 769 |
| |
770 | 770 |
| |
| |||
933 | 933 |
| |
934 | 934 |
| |
935 | 935 |
| |
936 |
| - | |
| 936 | + | |
937 | 937 |
| |
938 | 938 |
| |
939 |
| - | |
940 |
| - | |
941 |
| - | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
942 | 942 |
| |
943 |
| - | |
| 943 | + | |
944 | 944 |
| |
945 | 945 |
| |
946 | 946 |
| |
| |||
956 | 956 |
| |
957 | 957 |
| |
958 | 958 |
| |
959 |
| - | |
| 959 | + | |
960 | 960 |
| |
961 | 961 |
| |
962 |
| - | |
963 |
| - | |
964 |
| - | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
965 | 965 |
| |
966 |
| - | |
| 966 | + | |
967 | 967 |
| |
968 | 968 |
| |
969 | 969 |
| |
| |||
1107 | 1107 |
| |
1108 | 1108 |
| |
1109 | 1109 |
| |
1110 |
| - | |
1111 |
| - | |
1112 |
| - | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1113 | 1113 |
| |
1114 | 1114 |
| |
1115 | 1115 |
| |
| |||
1149 | 1149 |
| |
1150 | 1150 |
| |
1151 | 1151 |
| |
1152 |
| - | |
1153 |
| - | |
1154 |
| - | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
1155 | 1156 |
| |
1156 | 1157 |
| |
1157 | 1158 |
| |
|
Lines changed: 12 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
918 | 918 |
| |
919 | 919 |
| |
920 | 920 |
| |
921 |
| - | |
| 921 | + | |
922 | 922 |
| |
923 | 923 |
| |
924 | 924 |
| |
| |||
962 | 962 |
| |
963 | 963 |
| |
964 | 964 |
| |
965 |
| - | |
966 |
| - | |
967 |
| - | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
968 | 968 |
| |
969 |
| - | |
970 |
| - | |
971 |
| - | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
972 | 973 |
| |
973 | 974 |
| |
974 | 975 |
| |
| |||
14970 | 14971 |
| |
14971 | 14972 |
| |
14972 | 14973 |
| |
14973 |
| - | |
| 14974 | + | |
14974 | 14975 |
| |
14975 | 14976 |
| |
14976 | 14977 |
| |
| |||
15004 | 15005 |
| |
15005 | 15006 |
| |
15006 | 15007 |
| |
15007 |
| - | |
15008 |
| - | |
15009 |
| - | |
| 15008 | + | |
| 15009 | + | |
| 15010 | + | |
15010 | 15011 |
| |
15011 | 15012 |
| |
15012 | 15013 |
| |
|
Lines changed: 12 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
565 | 565 |
| |
566 | 566 |
| |
567 | 567 |
| |
568 |
| - | |
| 568 | + | |
569 | 569 |
| |
570 | 570 |
| |
571 | 571 |
| |
| |||
574 | 574 |
| |
575 | 575 |
| |
576 | 576 |
| |
577 |
| - | |
| 577 | + | |
578 | 578 |
| |
579 | 579 |
| |
580 | 580 |
| |
581 |
| - | |
582 |
| - | |
583 |
| - | |
584 |
| - | |
585 |
| - | |
586 |
| - | |
587 |
| - | |
588 |
| - | |
589 |
| - | |
590 |
| - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
591 | 591 |
| |
592 | 592 |
| |
593 | 593 |
| |
|
Lines changed: 12 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
341 | 341 |
| |
342 | 342 |
| |
343 | 343 |
| |
| 344 | + | |
344 | 345 |
| |
345 | 346 |
| |
346 | 347 |
| |
| |||
365 | 366 |
| |
366 | 367 |
| |
367 | 368 |
| |
368 |
| - | |
369 |
| - | |
370 |
| - | |
371 |
| - | |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 |
| - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
376 | 380 |
| |
377 | 381 |
| |
378 | 382 |
| |
|
Lines changed: 7 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1217 | 1217 |
| |
1218 | 1218 |
| |
1219 | 1219 |
| |
| 1220 | + | |
1220 | 1221 |
| |
1221 | 1222 |
| |
1222 | 1223 |
| |
| |||
1264 | 1265 |
| |
1265 | 1266 |
| |
1266 | 1267 |
| |
1267 |
| - | |
1268 |
| - | |
1269 |
| - | |
1270 |
| - | |
1271 |
| - | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
1272 | 1274 |
| |
1273 | 1275 |
| |
1274 | 1276 |
| |
|
0 commit comments
Comments
(0)