I tried this patch (applying it on Amit's last current version on top of
4e2970f8807f which is the latest it applies to) and regression tests
fail with the attached diff; in all cases it appears to be an off-by-one
in row count.  Would you please give it a look?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
*** /pgsql/source/master/src/test/regress/expected/partition_prune.out  
2018-01-04 13:29:04.518589165 -0300
--- 
/home/alvherre/Code/pgsql/build/master/src/test/regress/results/partition_prune.out
 2018-01-04 13:33:41.003865074 -0300
***************
*** 1836,1842 ****
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=51 
loops=2)
                             Filter: (a = ANY ('{0,0,1}'::integer[]))
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on 
ab_a1_b1 (actual rows=0 loops=1)
--- 1836,1842 ----
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=50 
loops=2)
                             Filter: (a = ANY ('{0,0,1}'::integer[]))
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on 
ab_a1_b1 (actual rows=0 loops=1)
***************
*** 1919,1927 ****
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=51 
loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 1
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on 
ab_a1_b1 (actual rows=0 loops=1)
                                   Index Cond: (a = a.a)
--- 1919,1927 ----
           Workers Launched: 1
           ->  Partial Aggregate (actual rows=1 loops=2)
                 ->  Nested Loop (actual rows=0 loops=2)
!                      ->  Parallel Seq Scan on lprt_a a (actual rows=50 
loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 0
                       ->  Append (actual rows=0 loops=101)
                             ->  Index Only Scan using ab_a1_b1_a_idx on 
ab_a1_b1 (actual rows=0 loops=1)
                                   Index Cond: (a = a.a)
***************
*** 1964,1970 ****
                 ->  Nested Loop (actual rows=0 loops=2)
                       ->  Parallel Seq Scan on lprt_a a (actual rows=50 
loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 1
                       ->  Append (actual rows=0 loops=100)
                             ->  Index Only Scan using ab_a1_b1_a_idx on 
ab_a1_b1 (never executed)
                                   Index Cond: (a = a.a)
--- 1964,1970 ----
                 ->  Nested Loop (actual rows=0 loops=2)
                       ->  Parallel Seq Scan on lprt_a a (actual rows=50 
loops=2)
                             Filter: (a = ANY ('{1,0,0}'::integer[]))
!                            Rows Removed by Filter: 0
                       ->  Append (actual rows=0 loops=100)
                             ->  Index Only Scan using ab_a1_b1_a_idx on 
ab_a1_b1 (never executed)
                                   Index Cond: (a = a.a)
***************
*** 2203,2209 ****
           ->  Index Only Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 2
!          ->  Index Only Scan using tprt3_idx on tprt_3 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 1
           ->  Index Only Scan using tprt4_idx on tprt_4 (never executed)
--- 2203,2209 ----
           ->  Index Only Scan using tprt2_idx on tprt_2 (actual rows=1 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 2
!          ->  Index Only Scan using tprt3_idx on tprt_3 (actual rows=0 loops=2)
                 Index Cond: (col1 = tbl1.col1)
                 Heap Fetches: 1
           ->  Index Only Scan using tprt4_idx on tprt_4 (never executed)

======================================================================

Reply via email to