- Notifications
You must be signed in to change notification settings - Fork5.2k
Commitc1777f2
Richard Guo
Fix assertion failure in generate_orderedappend_paths()
In generate_orderedappend_paths(), there is an assumption that a childrelation's row estimate is always greater than zero. There is anAssert verifying this assumption, and the estimate is also used toconvert an absolute tuple count into a fraction.However, this assumption is not always valid -- for example, upperrelations can have their row estimates unset, resulting in a value ofzero. This can cause an assertion failure in debug builds or lead tothe tuple fraction being computed as infinity in production builds.To fix, use the row estimate from the cheapest_total path to computethe tuple fraction. The row estimate in this path should already havebeen forced to a valid value.In passing, update the comment for generate_orderedappend_paths() tonote that the function also considers the cheapest-fractional casewhen not all tuples need to be retrieved. That is, it collects allthe cheapest fractional paths and builds an ordered append path foreach interesting ordering.Backpatch to v18, where this issue was introduced.Bug: #19102Reported-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com>Author: Richard Guo <guofenglinux@gmail.com>Reviewed-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com>Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>Discussion:https://postgr.es/m/19102-93480667e1200169@postgresql.orgBackpatch-through: 181 parenta4fd971 commitc1777f2
File tree
3 files changed
+49
-7
lines changed- src
- backend/optimizer/path
- test/regress
- expected
- sql
3 files changed
+49
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1810 | 1810 | | |
1811 | 1811 | | |
1812 | 1812 | | |
1813 | | - | |
1814 | | - | |
1815 | | - | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
1816 | 1818 | | |
1817 | 1819 | | |
1818 | 1820 | | |
| |||
1977 | 1979 | | |
1978 | 1980 | | |
1979 | 1981 | | |
1980 | | - | |
1981 | | - | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
1982 | 1988 | | |
1983 | | - | |
| 1989 | + | |
1984 | 1990 | | |
1985 | 1991 | | |
1986 | 1992 | | |
1987 | | - | |
| 1993 | + | |
1988 | 1994 | | |
1989 | 1995 | | |
1990 | 1996 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
342 | 373 | | |
343 | 374 | | |
344 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
0 commit comments
Comments
(0)