Fix parent of WCO qual.
authorAndres Freund <andres@anarazel.de>
Thu, 6 Dec 2018 01:28:05 +0000 (17:28 -0800)
committerAndres Freund <andres@anarazel.de>
Tue, 11 Dec 2018 00:48:56 +0000 (16:48 -0800)
Author:
Reviewed-By:
Discussion: https://postgr.es/m/
Backpatch:

src/backend/executor/nodeModifyTable.c
src/test/regress/expected/updatable_views.out

index 3c60bbcd9c0e2e69e3f80ad0cc72b454d1d57ed5..3aa0d4d0eb748528c506f1e26153cb03cbc80eca 100644 (file)
@@ -2269,7 +2269,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
        {
            WithCheckOption *wco = (WithCheckOption *) lfirst(ll);
            ExprState  *wcoExpr = ExecInitQual((List *) wco->qual,
-                                              mtstate->mt_plans[i]);
+                                              &mtstate->ps);
 
            wcoExprs = lappend(wcoExprs, wcoExpr);
        }
index e64d693e9c6fe9c131722979f80d0bb255b4ae71..0ac08ca51d2672f78f4abbf768cf993c0ce70dbc 100644 (file)
@@ -1782,31 +1782,31 @@ UPDATE rw_view1 SET a = a + 5; -- should fail
 ERROR:  new row violates check option for view "rw_view1"
 DETAIL:  Failing row contains (15).
 EXPLAIN (costs off) INSERT INTO rw_view1 VALUES (5);
-                          QUERY PLAN                           
----------------------------------------------------------------
+                       QUERY PLAN                        
+---------------------------------------------------------
  Insert on base_tbl b
    ->  Result
-         SubPlan 1
-           ->  Index Only Scan using ref_tbl_pkey on ref_tbl r
-                 Index Cond: (a = b.a)
-         SubPlan 2
-           ->  Seq Scan on ref_tbl r_1
+   SubPlan 1
+     ->  Index Only Scan using ref_tbl_pkey on ref_tbl r
+           Index Cond: (a = b.a)
+   SubPlan 2
+     ->  Seq Scan on ref_tbl r_1
 (7 rows)
 
 EXPLAIN (costs off) UPDATE rw_view1 SET a = a + 5;
-                           QUERY PLAN                            
------------------------------------------------------------------
+                        QUERY PLAN                         
+-----------------------------------------------------------
  Update on base_tbl b
    ->  Hash Join
          Hash Cond: (b.a = r.a)
          ->  Seq Scan on base_tbl b
          ->  Hash
                ->  Seq Scan on ref_tbl r
-         SubPlan 1
-           ->  Index Only Scan using ref_tbl_pkey on ref_tbl r_1
-                 Index Cond: (a = b.a)
-         SubPlan 2
-           ->  Seq Scan on ref_tbl r_2
+   SubPlan 1
+     ->  Index Only Scan using ref_tbl_pkey on ref_tbl r_1
+           Index Cond: (a = b.a)
+   SubPlan 2
+     ->  Seq Scan on ref_tbl r_2
 (11 rows)
 
 DROP TABLE base_tbl, ref_tbl CASCADE;