Commit 745e6ed
committed
Fix SPI_cursor_open() and SPI_is_cursor_plan() to push the SPI stack before
doing anything interesting, such as calling RevalidateCachedPlan(). The
necessity of this is demonstrated by an example from Willem Buitendyk:
during a replan, the planner might try to evaluate SPI-using functions,
and so we'd better be in a clean SPI context.
A small downside of this fix is that these two functions will now fail
outright if called when not inside a SPI-using procedure (ie, a
SPI_connect/SPI_finish pair). The documentation never promised or suggested
that that would work, though; and they are normally used in concert with
other functions, mainly SPI_prepare, that always have failed in such a case.
So the odds of breaking something seem pretty low.
In passing, make SPI_is_cursor_plan's error handling convention clearer,
and fix documentation's erroneous claim that SPI_cursor_open would
return NULL on error.
Before 8.3 these functions could not invoke replanning, so there is probably
no need for back-patching.1 parent 953c2c9 commit 745e6ed
2 files changed
+28
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
1077 | 1077 | | |
1078 | 1078 | | |
1079 | 1079 | | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1083 | 1086 | | |
1084 | 1087 | | |
1085 | 1088 | | |
| |||
1442 | 1445 | | |
1443 | 1446 | | |
1444 | 1447 | | |
1445 | | - | |
1446 | | - | |
| 1448 | + | |
| 1449 | + | |
1447 | 1450 | | |
1448 | 1451 | | |
1449 | 1452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
889 | 893 | | |
890 | 894 | | |
891 | 895 | | |
| |||
1041 | 1045 | | |
1042 | 1046 | | |
1043 | 1047 | | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
1044 | 1051 | | |
1045 | 1052 | | |
1046 | 1053 | | |
| |||
1180 | 1187 | | |
1181 | 1188 | | |
1182 | 1189 | | |
| 1190 | + | |
| 1191 | + | |
1183 | 1192 | | |
| 1193 | + | |
1184 | 1194 | | |
1185 | 1195 | | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1186 | 1201 | | |
1187 | 1202 | | |
1188 | 1203 | | |
1189 | 1204 | | |
1190 | 1205 | | |
1191 | 1206 | | |
1192 | 1207 | | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1193 | 1211 | | |
1194 | 1212 | | |
1195 | 1213 | | |
| |||
0 commit comments