Commit d0cfc3d
committed
Add a debugging option to stress-test outfuncs.c and readfuncs.c.
In the normal course of operation, query trees will be serialized only if
they are stored as views or rules; and plan trees will be serialized only
if they get passed to parallel-query workers. This leaves an awful lot of
opportunity for bugs/oversights to not get detected, as indeed we've just
been reminded of the hard way.
To improve matters, this patch adds a new compile option
WRITE_READ_PARSE_PLAN_TREES, which is modeled on the longstanding option
COPY_PARSE_PLAN_TREES; but instead of passing all parse and plan trees
through copyObject, it passes them through nodeToString + stringToNode.
Enabling this option in a buildfarm animal or two will catch problems
at least for cases that are exercised by the regression tests.
A small problem with this idea is that readfuncs.c historically has
discarded location fields, on the reasonable grounds that parse
locations in a retrieved view are not relevant to the current query.
But doing that in WRITE_READ_PARSE_PLAN_TREES breaks pg_stat_statements,
and it could cause problems for future improvements that might try to
report error locations at runtime. To fix that, provide a variant
behavior in readfuncs.c that makes it restore location fields when
told to.
In passing, const-ify the string arguments of stringToNode and its
subsidiary functions, just because it annoyed me that they weren't
const already.
Discussion: https://postgr.es/m/17114.1537138992@sss.pgh.pa.us1 parent db1071d commit d0cfc3d
File tree
7 files changed
+170
-29
lines changed- src
- backend
- nodes
- parser
- tcop
- include
- nodes
7 files changed
+170
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
36 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
37 | 46 | | |
38 | | - | |
39 | | - | |
| 47 | + | |
| 48 | + | |
40 | 49 | | |
41 | | - | |
42 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
| |||
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
54 | 74 | | |
55 | 75 | | |
56 | 76 | | |
57 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
58 | 82 | | |
59 | 83 | | |
60 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
61 | 105 | | |
62 | 106 | | |
63 | 107 | | |
| |||
104 | 148 | | |
105 | 149 | | |
106 | 150 | | |
107 | | - | |
| 151 | + | |
108 | 152 | | |
109 | 153 | | |
110 | | - | |
111 | | - | |
| 154 | + | |
| 155 | + | |
112 | 156 | | |
113 | 157 | | |
114 | 158 | | |
| |||
166 | 210 | | |
167 | 211 | | |
168 | 212 | | |
169 | | - | |
| 213 | + | |
170 | 214 | | |
171 | 215 | | |
172 | 216 | | |
| |||
198 | 242 | | |
199 | 243 | | |
200 | 244 | | |
201 | | - | |
| 245 | + | |
202 | 246 | | |
203 | 247 | | |
204 | | - | |
| 248 | + | |
205 | 249 | | |
206 | 250 | | |
207 | 251 | | |
| |||
269 | 313 | | |
270 | 314 | | |
271 | 315 | | |
272 | | - | |
| 316 | + | |
273 | 317 | | |
274 | 318 | | |
275 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
54 | | - | |
| 58 | + | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| |||
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
123 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
127 | 137 | | |
128 | 138 | | |
| 139 | + | |
129 | 140 | | |
130 | 141 | | |
131 | 142 | | |
| |||
2804 | 2815 | | |
2805 | 2816 | | |
2806 | 2817 | | |
2807 | | - | |
| 2818 | + | |
2808 | 2819 | | |
2809 | 2820 | | |
2810 | 2821 | | |
| |||
2817 | 2828 | | |
2818 | 2829 | | |
2819 | 2830 | | |
2820 | | - | |
| 2831 | + | |
2821 | 2832 | | |
2822 | 2833 | | |
2823 | 2834 | | |
| |||
2847 | 2858 | | |
2848 | 2859 | | |
2849 | 2860 | | |
2850 | | - | |
| 2861 | + | |
2851 | 2862 | | |
2852 | 2863 | | |
2853 | 2864 | | |
| |||
2860 | 2871 | | |
2861 | 2872 | | |
2862 | 2873 | | |
2863 | | - | |
| 2874 | + | |
2864 | 2875 | | |
2865 | 2876 | | |
2866 | 2877 | | |
| |||
2884 | 2895 | | |
2885 | 2896 | | |
2886 | 2897 | | |
2887 | | - | |
| 2898 | + | |
2888 | 2899 | | |
2889 | 2900 | | |
2890 | 2901 | | |
| |||
2908 | 2919 | | |
2909 | 2920 | | |
2910 | 2921 | | |
2911 | | - | |
| 2922 | + | |
2912 | 2923 | | |
2913 | 2924 | | |
2914 | 2925 | | |
| |||
2932 | 2943 | | |
2933 | 2944 | | |
2934 | 2945 | | |
2935 | | - | |
| 2946 | + | |
2936 | 2947 | | |
2937 | 2948 | | |
2938 | 2949 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1335 | 1335 | | |
1336 | 1336 | | |
1337 | 1337 | | |
1338 | | - | |
1339 | 1338 | | |
1340 | 1339 | | |
1341 | 1340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
636 | 642 | | |
637 | 643 | | |
638 | 644 | | |
| |||
763 | 769 | | |
764 | 770 | | |
765 | 771 | | |
766 | | - | |
| 772 | + | |
767 | 773 | | |
768 | 774 | | |
769 | 775 | | |
| |||
776 | 782 | | |
777 | 783 | | |
778 | 784 | | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
779 | 825 | | |
780 | 826 | | |
781 | 827 | | |
| |||
812 | 858 | | |
813 | 859 | | |
814 | 860 | | |
815 | | - | |
| 861 | + | |
816 | 862 | | |
817 | 863 | | |
818 | 864 | | |
| |||
830 | 876 | | |
831 | 877 | | |
832 | 878 | | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
833 | 903 | | |
834 | 904 | | |
835 | 905 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
614 | 617 | | |
615 | 618 | | |
616 | 619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
0 commit comments