forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitaf3deff
committed
Fix slot type handling for Agg nodes performing internal sorts.
Since15d8f83 we assert that - and since7ef04e4,4da597erely on - the slot type for an expression'secxt_{outer,inner,scan}tuple not changing, unless explicitly flaggedas such. That allows to either skip deforming (for a virtual tupleslot) or optimize the code for JIT accelerated deformingappropriately (for other known slot types).This assumption was sometimes violated for grouping sets, whennodeAgg.c internally uses tuplesorts, and the child node doesn'treturn a TTSOpsMinimalTuple type slot. Detect that case, and flag thatthe outer slot might not be "fixed".It's probably worthwhile to optimize this further in the future, andmore granularly determine whether the slot is fixed. As we alreadyinstantiate per-phase transition and equal expressions, we couldcheaply set the slot type appropriately for each phase. But that's aseparate change from this bugfix.This commit does include a very minor optimization by avoiding tocreate a slot for handling tuplesorts, if no such sorts areperformed. Previously we created that slot unnecessarily in the commoncase of computing all grouping sets via hashing. The code looked tooconfusing without that, as the conditions for needing a sort slot andflagging that the slot type isn't fixed, are the same.Reported-By: Ashutosh SharmaAuthor: Andres FreundDiscussion:https://postgr.es/m/CAE9k0PmNaMD2oHTEAhRyxnxpaDaYkuBYkLa1dpOpn=RS0iS2AQ@mail.gmail.comBackpatch: 12-, where the bug was introduced in15d8f831 parentcb9bb15 commitaf3deff
File tree
3 files changed
+99
-2
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+99
-2
lines changedLines changed: 32 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2231 | 2231 |
| |
2232 | 2232 |
| |
2233 | 2233 |
| |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
2234 | 2239 |
| |
2235 |
| - | |
| 2240 | + | |
2236 | 2241 |
| |
2237 |
| - | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
2238 | 2249 |
| |
2239 | 2250 |
| |
2240 | 2251 |
| |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
2241 | 2271 |
| |
2242 | 2272 |
| |
2243 | 2273 |
| |
|
Lines changed: 55 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1360 | 1360 |
| |
1361 | 1361 |
| |
1362 | 1362 |
| |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
1363 | 1418 |
| |
1364 | 1419 |
| |
1365 | 1420 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
384 | 384 |
| |
385 | 385 |
| |
386 | 386 |
| |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
387 | 399 |
| |
388 | 400 |
| |
389 | 401 |
| |
|
0 commit comments
Comments
(0)