forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit537ca68
committed
Identify simple column references in extended statistics
Until now, when defining extended statistics, everything except a plaincolumn reference was treated as complex expression. So for example "a"was a column reference, but "(a)" would be an expression. In most casesthis does not matter much, but there were a couple strange consequences.For example CREATE STATISTICS s ON a FROM t;would fail, because extended stats require at least two columns. But CREATE STATISTICS s ON (a) FROM t;would succeed, because that requirement does not apply to expressions.Moreover, that statistics object is useless - the optimizer will alwaysuse the regular statistics collected for attribute "a".So do a bit more work to identify those expressions referencing a singlecolumn, and translate them to a simple column reference. Backpatch to14, where support for extended statistics on expressions was introduced.Reported-by: Justin PryzbyBackpatch-through: 14Discussion:https://postgr.es/m/20210816013255.GS10479%40telsasoft.com1 parentb0c0662 commit537ca68
File tree
3 files changed
+34
-6
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+34
-6
lines changedLines changed: 31 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| 36 | + | |
36 | 37 |
| |
37 | 38 |
| |
38 | 39 |
| |
| |||
211 | 212 |
| |
212 | 213 |
| |
213 | 214 |
| |
214 |
| - | |
| 215 | + | |
| 216 | + | |
215 | 217 |
| |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
221 | 224 |
| |
222 | 225 |
| |
223 | 226 |
| |
| |||
258 | 261 |
| |
259 | 262 |
| |
260 | 263 |
| |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
261 | 286 |
| |
262 | 287 |
| |
263 | 288 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
| 58 | + | |
| 59 | + | |
58 | 60 |
| |
59 | 61 |
| |
60 | 62 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| 44 | + | |
44 | 45 |
| |
45 | 46 |
| |
46 | 47 |
| |
|
0 commit comments
Comments
(0)