forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite7ef6d7
committed
Fix planner to pass correct collation to operator selectivity estimators.
We can do this without creating an API break for estimation functionsby passing the collation using the existing fmgr functionality forpassing an input collation as a hidden parameter.The need for this was foreseen at the outset, but we didn't get around tomaking it happen in 9.1 because of the decision to sort all pg_statistichistograms according to the database's default collation. That meant thatselectivity estimators generally need to use the default collation too,even if they're estimating for an operator that will do somethingdifferent. The reason it's suddenly become more interesting is thatregexp interpretation also uses a collation (for its LC_TYPE not LC_COLLATEproperty), and we no longer want to use the wrong collation when examiningregexps during planning. It's not that the selectivity estimate is likelyto change much from this; rather that we are thinking of caching compiledregexps during planner estimation, and we won't get the intended benefitif we cache them with a different collation than the executor will use.Back-patch to 9.1, both because the regexp change is likely to getback-patched and because we might as well get this right in allcollation-supporting branches, in case any third-party code wants torely on getting the collation. The patch turns out to be minusculenow that I've done it ...1 parentc6aae30 commite7ef6d7
File tree
4 files changed
+83
-51
lines changed- src
- backend
- optimizer
- path
- util
- utils/adt
- include/optimizer
4 files changed
+83
-51
lines changedLines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
578 | 578 |
| |
579 | 579 |
| |
580 | 580 |
| |
| 581 | + | |
581 | 582 |
| |
582 | 583 |
| |
583 | 584 |
| |
| |||
649 | 650 |
| |
650 | 651 |
| |
651 | 652 |
| |
652 |
| - | |
| 653 | + | |
| 654 | + | |
653 | 655 |
| |
654 | 656 |
| |
655 | 657 |
| |
656 | 658 |
| |
657 | 659 |
| |
658 |
| - | |
| 660 | + | |
| 661 | + | |
659 | 662 |
| |
660 | 663 |
| |
661 | 664 |
| |
662 | 665 |
| |
663 | 666 |
| |
664 | 667 |
| |
665 | 668 |
| |
666 |
| - | |
| 669 | + | |
| 670 | + | |
667 | 671 |
| |
668 | 672 |
| |
669 | 673 |
| |
|
Lines changed: 15 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1010 | 1010 |
| |
1011 | 1011 |
| |
1012 | 1012 |
| |
| 1013 | + | |
1013 | 1014 |
| |
1014 | 1015 |
| |
1015 | 1016 |
| |
| |||
1022 | 1023 |
| |
1023 | 1024 |
| |
1024 | 1025 |
| |
1025 |
| - | |
1026 |
| - | |
1027 |
| - | |
1028 |
| - | |
1029 |
| - | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
1030 | 1032 |
| |
1031 | 1033 |
| |
1032 | 1034 |
| |
| |||
1045 | 1047 |
| |
1046 | 1048 |
| |
1047 | 1049 |
| |
| 1050 | + | |
1048 | 1051 |
| |
1049 | 1052 |
| |
1050 | 1053 |
| |
| |||
1058 | 1061 |
| |
1059 | 1062 |
| |
1060 | 1063 |
| |
1061 |
| - | |
1062 |
| - | |
1063 |
| - | |
1064 |
| - | |
1065 |
| - | |
1066 |
| - | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1067 | 1071 |
| |
1068 | 1072 |
| |
1069 | 1073 |
| |
|
Lines changed: 59 additions & 37 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
83 | 83 |
| |
84 | 84 |
| |
85 | 85 |
| |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
86 | 95 |
| |
87 | 96 |
| |
88 | 97 |
| |
| |||
1097 | 1106 |
| |
1098 | 1107 |
| |
1099 | 1108 |
| |
| 1109 | + | |
1100 | 1110 |
| |
1101 | 1111 |
| |
1102 | 1112 |
| |
| |||
1197 | 1207 |
| |
1198 | 1208 |
| |
1199 | 1209 |
| |
1200 |
| - | |
1201 |
| - | |
1202 |
| - | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
1203 | 1216 |
| |
1204 | 1217 |
| |
1205 |
| - | |
| 1218 | + | |
1206 | 1219 |
| |
1207 | 1220 |
| |
1208 | 1221 |
| |
| |||
1847 | 1860 |
| |
1848 | 1861 |
| |
1849 | 1862 |
| |
1850 |
| - | |
1851 |
| - | |
1852 |
| - | |
1853 |
| - | |
1854 |
| - | |
1855 |
| - | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
1856 | 1870 |
| |
1857 |
| - | |
1858 |
| - | |
1859 |
| - | |
1860 |
| - | |
1861 |
| - | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
1862 | 1877 |
| |
1863 | 1878 |
| |
1864 | 1879 |
| |
| |||
1912 | 1927 |
| |
1913 | 1928 |
| |
1914 | 1929 |
| |
1915 |
| - | |
1916 |
| - | |
1917 |
| - | |
1918 |
| - | |
1919 |
| - | |
1920 |
| - | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
1921 | 1937 |
| |
1922 |
| - | |
1923 |
| - | |
1924 |
| - | |
1925 |
| - | |
1926 |
| - | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
1927 | 1944 |
| |
1928 | 1945 |
| |
1929 | 1946 |
| |
| |||
1962 | 1979 |
| |
1963 | 1980 |
| |
1964 | 1981 |
| |
1965 |
| - | |
1966 |
| - | |
1967 |
| - | |
1968 |
| - | |
1969 |
| - | |
1970 |
| - | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
1971 | 1989 |
| |
1972 |
| - | |
1973 |
| - | |
1974 |
| - | |
1975 |
| - | |
1976 |
| - | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
1977 | 1996 |
| |
1978 | 1997 |
| |
1979 | 1998 |
| |
| |||
2046 | 2065 |
| |
2047 | 2066 |
| |
2048 | 2067 |
| |
| 2068 | + | |
2049 | 2069 |
| |
2050 | 2070 |
| |
2051 | 2071 |
| |
| |||
2086 | 2106 |
| |
2087 | 2107 |
| |
2088 | 2108 |
| |
| 2109 | + | |
2089 | 2110 |
| |
2090 | 2111 |
| |
2091 | 2112 |
| |
| |||
2094 | 2115 |
| |
2095 | 2116 |
| |
2096 | 2117 |
| |
| 2118 | + | |
2097 | 2119 |
| |
2098 | 2120 |
| |
2099 | 2121 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
| 46 | + | |
46 | 47 |
| |
47 | 48 |
| |
48 | 49 |
| |
49 | 50 |
| |
50 | 51 |
| |
| 52 | + | |
51 | 53 |
| |
52 | 54 |
| |
53 | 55 |
| |
|
0 commit comments
Comments
(0)