Commit b5febc1
committed
Fix IOS planning when only some index columns can return an attribute.
Since 9.5, it's possible that some but not all columns of an index
support returning the indexed value for index-only scans. If the
same indexed column appears in index columns that behave both ways,
check_index_only() supposed that it'd be OK to do an index-only scan
testing that column; but that fails if we have to recheck the indexed
condition on one of the columns that doesn't support this.
In principle we could make this work by remapping the recheck expressions
to pull the value from a column that does support returning the indexed
value. But such cases are so weird and rare that, at least for now,
it doesn't seem worth the trouble. Instead, just teach check_index_only
that a value is returnable only if all the index columns containing it
are returnable, rather than any of them.
Per report from David Pereiro Lagares. Back-patch to 9.5 where the
possibility of this situation appeared.
Kyotaro Horiguchi
Discussion: https://postgr.es/m/1516210494.1798.16.camel@nlpgo.com1 parent 6452b09 commit b5febc1
File tree
3 files changed
+71
-1
lines changed- contrib/btree_gist
- expected
- sql
- src/backend/optimizer/path
3 files changed
+71
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1866 | 1866 | | |
1867 | 1867 | | |
1868 | 1868 | | |
| 1869 | + | |
1869 | 1870 | | |
1870 | 1871 | | |
1871 | 1872 | | |
| |||
1905 | 1906 | | |
1906 | 1907 | | |
1907 | 1908 | | |
1908 | | - | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
1909 | 1914 | | |
1910 | 1915 | | |
1911 | 1916 | | |
| |||
1922 | 1927 | | |
1923 | 1928 | | |
1924 | 1929 | | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
1925 | 1934 | | |
1926 | 1935 | | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
1927 | 1939 | | |
1928 | 1940 | | |
1929 | 1941 | | |
1930 | 1942 | | |
1931 | 1943 | | |
| 1944 | + | |
1932 | 1945 | | |
1933 | 1946 | | |
1934 | 1947 | | |
| |||
0 commit comments