- Notifications
You must be signed in to change notification settings - Fork5
Commit9257f07
committed
Replace uses of SPI_modifytuple that intend to allocate in current context.
Invent a new function heap_modify_tuple_by_cols() that is functionallyequivalent to SPI_modifytuple except that it always allocates its resultby simple palloc. I chose however to make the API details a bit morelike heap_modify_tuple: pass a tupdesc rather than a Relation, and usebool convention for the isnull array.Use this function in place of SPI_modifytuple at all call sites where theintended behavior is to allocate in current context. (There actually areonly two call sites left that depend on the old behavior, which makes mewonder if we should just drop this function rather than keep it.)This new function is easier to use than heap_modify_tuple() for purposesof replacing a single column (or, really, any fixed number of columns).There are a number of places where it would simplify the code to changeover, but I resisted that temptation for the moment ... everywhere exceptin plpgsql's exec_assign_value(); changing that might offer some smallperformance benefit, so I did it.This is on the way to removing SPI_push/SPI_pop, but it seems likegood code cleanup in its own right.Discussion: <9633.1478552022@sss.pgh.pa.us>1 parentdce429b commit9257f07
File tree
10 files changed
+137
-95
lines changed- contrib/spi
- doc/src/sgml
- src
- backend
- access/common
- utils/adt
- include/access
- pl/plpgsql/src
- test/regress
10 files changed
+137
-95
lines changedLines changed: 8 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| 6 | + | |
6 | 7 |
| |
7 | 8 |
| |
8 | 9 |
| |
| |||
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
| |
| 27 | + | |
26 | 28 |
| |
27 | 29 |
| |
28 | 30 |
| |
| |||
64 | 66 |
| |
65 | 67 |
| |
66 | 68 |
| |
| 69 | + | |
67 | 70 |
| |
68 | 71 |
| |
69 | 72 |
| |
| |||
102 | 105 |
| |
103 | 106 |
| |
104 | 107 |
| |
| 108 | + | |
105 | 109 |
| |
106 | 110 |
| |
107 | 111 |
| |
108 | 112 |
| |
109 | 113 |
| |
110 | 114 |
| |
111 | 115 |
| |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
117 | 119 |
| |
118 | 120 |
| |
119 | 121 |
| |
120 | 122 |
| |
121 | 123 |
| |
| 124 | + | |
122 | 125 |
| |
123 | 126 |
| |
124 | 127 |
|
Lines changed: 5 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
3 |
| - | |
4 | 2 |
| |
5 | 3 |
| |
6 | 4 |
| |
7 | 5 |
| |
8 | 6 |
| |
9 | 7 |
| |
10 | 8 |
| |
| 9 | + | |
11 | 10 |
| |
12 | 11 |
| |
13 | 12 |
| |
| |||
26 | 25 |
| |
27 | 26 |
| |
28 | 27 |
| |
| 28 | + | |
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
| |||
80 | 80 |
| |
81 | 81 |
| |
82 | 82 |
| |
| 83 | + | |
83 | 84 |
| |
84 | 85 |
| |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 |
| - | |
| 86 | + | |
| 87 | + | |
90 | 88 |
| |
91 | 89 |
| |
92 | 90 |
| |
|
Lines changed: 7 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
| |||
34 | 35 |
| |
35 | 36 |
| |
36 | 37 |
| |
| 38 | + | |
37 | 39 |
| |
38 | 40 |
| |
39 | 41 |
| |
| |||
115 | 117 |
| |
116 | 118 |
| |
117 | 119 |
| |
| 120 | + | |
118 | 121 |
| |
119 |
| - | |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
126 |
| - | |
127 |
| - | |
128 |
| - | |
129 |
| - | |
130 |
| - | |
131 |
| - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
132 | 125 |
| |
133 |
| - | |
| 126 | + | |
134 | 127 |
| |
135 | 128 |
| |
136 | 129 |
| |
|
Lines changed: 13 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| 14 | + | |
14 | 15 |
| |
15 | 16 |
| |
16 | 17 |
| |
| |||
183 | 184 |
| |
184 | 185 |
| |
185 | 186 |
| |
186 |
| - | |
| 187 | + | |
187 | 188 |
| |
188 | 189 |
| |
189 | 190 |
| |
190 | 191 |
| |
191 | 192 |
| |
192 |
| - | |
| 193 | + | |
193 | 194 |
| |
194 | 195 |
| |
195 | 196 |
| |
| |||
201 | 202 |
| |
202 | 203 |
| |
203 | 204 |
| |
204 |
| - | |
| 205 | + | |
205 | 206 |
| |
206 | 207 |
| |
207 | 208 |
| |
| |||
220 | 221 |
| |
221 | 222 |
| |
222 | 223 |
| |
223 |
| - | |
| 224 | + | |
224 | 225 |
| |
225 | 226 |
| |
226 | 227 |
| |
227 | 228 |
| |
228 |
| - | |
| 229 | + | |
229 | 230 |
| |
230 | 231 |
| |
231 | 232 |
| |
232 | 233 |
| |
233 |
| - | |
| 234 | + | |
234 | 235 |
| |
235 | 236 |
| |
236 | 237 |
| |
237 |
| - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
238 | 241 |
| |
239 | 242 |
| |
240 | 243 |
| |
| |||
395 | 398 |
| |
396 | 399 |
| |
397 | 400 |
| |
398 |
| - | |
399 |
| - | |
400 | 401 |
| |
401 |
| - | |
402 |
| - | |
| 402 | + | |
| 403 | + | |
403 | 404 |
| |
404 |
| - | |
| 405 | + | |
405 | 406 |
| |
406 | 407 |
| |
407 | 408 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3382 | 3382 |
| |
3383 | 3383 |
| |
3384 | 3384 |
| |
3385 |
| - | |
3386 |
| - | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
3387 | 3388 |
| |
3388 | 3389 |
| |
3389 | 3390 |
| |
|
Lines changed: 66 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
846 | 846 |
| |
847 | 847 |
| |
848 | 848 |
| |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 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 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
849 | 915 |
| |
850 | 916 |
| |
851 | 917 |
| |
|
Lines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2329 | 2329 |
| |
2330 | 2330 |
| |
2331 | 2331 |
| |
2332 |
| - | |
2333 |
| - | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
2334 | 2336 |
| |
2335 | 2337 |
| |
2336 | 2338 |
| |
| |||
2340 | 2342 |
| |
2341 | 2343 |
| |
2342 | 2344 |
| |
2343 |
| - | |
2344 |
| - | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
2345 | 2349 |
| |
2346 | 2350 |
| |
2347 | 2351 |
| |
2348 |
| - | |
2349 |
| - | |
2350 |
| - | |
2351 |
| - | |
2352 | 2352 |
| |
2353 | 2353 |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
805 | 805 |
| |
806 | 806 |
| |
807 | 807 |
| |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
808 | 814 |
| |
809 | 815 |
| |
810 | 816 |
| |
|
0 commit comments
Comments
(0)