forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit53ee9f5
committed
Remove the restriction originally coded into optimize_minmax_aggregates() that
MIN/MAX not be converted to use an index if the query WHERE clause containsany volatile functions or subplans.I had originally feared that the conversion might alter the behavior of such aquery with respect to a volatile function. Well, so it might, but only in thesense that the function would get evaluated at a subset of the table rowsrather than all of them --- and we have never made any such guarantee anyway.(For instance, we don't refuse to use an index for an ordinary non-aggregatequery when one of the non-indexable filter conditions contains a volatilefunction.)The prohibition against subplans was because of worry that that case wasn'tadequately tested, which it wasn't, but it turns out to be possible to make8.1 fail anyway:regression=# select o.ten, (select max(unique2) from tenk1 i where ten = o.tenor ten = (select f1 from int4_tbl limit 1)) from tenk1 o;ERROR: direct correlated subquery unsupported as initplanThis is due to bogus code in SS_make_initplan_from_plan (it's an initplan,ergo it can't have any parParams). Having fixed that, we might as well allowsubplans as well as initplans.1 parent4c5eb2c commit53ee9f5
2 files changed
+5
-25
lines changedLines changed: 2 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
126 |
| - | |
127 |
| - | |
128 |
| - | |
129 | 120 |
| |
130 | 121 |
| |
131 | 122 |
| |
| |||
509 | 500 |
| |
510 | 501 |
| |
511 | 502 |
| |
512 |
| - | |
| 503 | + | |
513 | 504 |
| |
514 | 505 |
| |
515 | 506 |
| |
|
Lines changed: 3 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
1248 | 1248 |
| |
1249 | 1249 |
| |
1250 | 1250 |
| |
1251 |
| - | |
1252 |
| - | |
1253 | 1251 |
| |
1254 | 1252 |
| |
1255 | 1253 |
| |
| |||
1280 | 1278 |
| |
1281 | 1279 |
| |
1282 | 1280 |
| |
1283 |
| - | |
1284 |
| - | |
| 1281 | + | |
| 1282 | + | |
1285 | 1283 |
| |
1286 |
| - | |
1287 |
| - | |
1288 |
| - | |
1289 |
| - | |
1290 |
| - | |
1291 |
| - | |
1292 |
| - | |
1293 |
| - | |
1294 |
| - | |
1295 | 1284 |
| |
1296 | 1285 |
| |
1297 | 1286 |
| |
|
0 commit comments
Comments
(0)