forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit44468f4
committed
Add test scaffolding for exercising optimizer's predicate-proof logic.
The predicate-proof code in predtest.c is a bit hard to test as-is:you have to construct a query whose plan changes depending on the successof a test, and in tests that have been around for awhile, it's alwayspossible that the plan shape is now being determined by some other factor.Our existing regression tests aren't doing real well at providing fullcode coverage of predtest.c, either. So, let's add a small test modulethat allows directly inspecting the results of predicate_implied_by()and predicate_refuted_by() for arbitrary boolean expressions.I chose the set of tests committed here in order to get reasonablycomplete code coverage of predtest.c just from running this testmodule, and to cover some cases called out as being interesting inthe existing comments. We might want to add more later. But thisset already shows a few cases where perhaps things could be improved.Indeed, this exercise proves that predicate_refuted_by() is buggy forthe case of clause_is_check = true, though fortunately we aren't usingthat case anywhere yet. I'll look into doing something about that ina separate commit. For now, just memorialize the current behavior.Discussion:https://postgr.es/m/5983.1520487191@sss.pgh.pa.us1 parent04e7eca commit44468f4
File tree
9 files changed
+1356
-0
lines changed- src/test/modules
- test_predtest
- expected
- sql
9 files changed
+1356
-0
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
| 16 | + | |
16 | 17 |
| |
17 | 18 |
| |
18 | 19 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + |
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + |
Lines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + |
0 commit comments
Comments
(0)