Commit 199012a
committed
Fix asymmetry in setting EquivalenceClass.ec_sortref
0452b46 made get_eclass_for_sort_expr() always set
EquivalenceClass.ec_sortref if it's not done yet. This leads to an asymmetric
situation when whoever first looks for the EquivalenceClass sets the
ec_sortref. It is also counterintuitive that get_eclass_for_sort_expr()
performs modification of data structures.
This commit makes make_pathkeys_for_sortclauses_extended() responsible for
setting EquivalenceClass.ec_sortref. Now we set the
EquivalenceClass.ec_sortref's needed to explore alternative GROUP BY ordering
specifically during building pathkeys by the list of grouping clauses.
Discussion: https://postgr.es/m/17037754-f187-4138-8285-0e2bfebd0dea%40postgrespro.ru
Reported-by: Tom Lane
Author: Andrei Lepikhov
Reviewed-by: Alexander Korotkov, Pavel Borisov1 parent f654f00 commit 199012a
File tree
6 files changed
+92
-19
lines changed- src
- backend/optimizer
- path
- plan
- include/optimizer
- test/regress
- expected
- sql
6 files changed
+92
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
| 655 | + | |
667 | 656 | | |
668 | 657 | | |
669 | 658 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1355 | 1355 | | |
1356 | 1356 | | |
1357 | 1357 | | |
1358 | | - | |
| 1358 | + | |
| 1359 | + | |
1359 | 1360 | | |
1360 | 1361 | | |
1361 | 1362 | | |
| |||
1379 | 1380 | | |
1380 | 1381 | | |
1381 | 1382 | | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
1382 | 1386 | | |
1383 | 1387 | | |
1384 | 1388 | | |
1385 | 1389 | | |
1386 | 1390 | | |
1387 | 1391 | | |
1388 | | - | |
| 1392 | + | |
| 1393 | + | |
1389 | 1394 | | |
1390 | 1395 | | |
1391 | 1396 | | |
| |||
1409 | 1414 | | |
1410 | 1415 | | |
1411 | 1416 | | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
1412 | 1426 | | |
1413 | 1427 | | |
1414 | 1428 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3395 | 3395 | | |
3396 | 3396 | | |
3397 | 3397 | | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
3398 | 3402 | | |
3399 | 3403 | | |
3400 | 3404 | | |
3401 | 3405 | | |
3402 | 3406 | | |
3403 | | - | |
| 3407 | + | |
| 3408 | + | |
3404 | 3409 | | |
3405 | 3410 | | |
3406 | 3411 | | |
| |||
3450 | 3455 | | |
3451 | 3456 | | |
3452 | 3457 | | |
3453 | | - | |
| 3458 | + | |
| 3459 | + | |
3454 | 3460 | | |
3455 | 3461 | | |
3456 | 3462 | | |
| |||
3476 | 3482 | | |
3477 | 3483 | | |
3478 | 3484 | | |
3479 | | - | |
| 3485 | + | |
| 3486 | + | |
3480 | 3487 | | |
3481 | 3488 | | |
3482 | 3489 | | |
| |||
6061 | 6068 | | |
6062 | 6069 | | |
6063 | 6070 | | |
6064 | | - | |
| 6071 | + | |
| 6072 | + | |
6065 | 6073 | | |
6066 | 6074 | | |
6067 | 6075 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
| 243 | + | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2917 | 2917 | | |
2918 | 2918 | | |
2919 | 2919 | | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
2920 | 2967 | | |
2921 | 2968 | | |
2922 | 2969 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1263 | 1263 | | |
1264 | 1264 | | |
1265 | 1265 | | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
1266 | 1280 | | |
1267 | 1281 | | |
1268 | 1282 | | |
| |||
0 commit comments