* es_param_exec_vals, etc.
*
* The ResultRelInfo array management is trickier than it looks. We
- * create a fresh array for the child but copy all the content from the
+ * create fresh arrays for the child but copy all the content from the
* parent. This is because it's okay for the child to share any
* per-relation state the parent has already created --- but if the child
* sets up any ResultRelInfo fields, such as its own junkfilter, that
if (parentestate->es_num_result_relations > 0)
{
int numResultRelations = parentestate->es_num_result_relations;
+ int numRootResultRels = parentestate->es_num_root_result_relations;
ResultRelInfo *resultRelInfos;
resultRelInfos = (ResultRelInfo *)
numResultRelations * sizeof(ResultRelInfo));
estate->es_result_relations = resultRelInfos;
estate->es_num_result_relations = numResultRelations;
+
+ /* Also transfer partitioned root result relations. */
+ if (numRootResultRels > 0)
+ {
+ resultRelInfos = (ResultRelInfo *)
+ palloc(numRootResultRels * sizeof(ResultRelInfo));
+ memcpy(resultRelInfos, parentestate->es_root_result_relations,
+ numRootResultRels * sizeof(ResultRelInfo));
+ estate->es_root_result_relations = resultRelInfos;
+ estate->es_num_root_result_relations = numRootResultRels;
+ }
}
/* es_result_relation_info must NOT be copied */
/* es_trig_target_relations must NOT be copied */
CREATE TABLE jointest AS SELECT generate_series(1,10) AS id, 0 AS data;
CREATE INDEX ON jointest(id);
+
+ CREATE TABLE parttbl (a int) PARTITION BY LIST (a);
+ CREATE TABLE parttbl1 PARTITION OF parttbl FOR VALUES IN (1);
+ INSERT INTO parttbl VALUES (1);
}
teardown
DROP TABLE accounts;
DROP TABLE p CASCADE;
DROP TABLE table_a, table_b, jointest;
+ DROP TABLE parttbl;
}
session "s1"
select * from jointest a join jointest b on a.id=b.id for update;
}
+# test for EPQ on a partitioned result table
+
+step "simplepartupdate" {
+ update parttbl set a = a;
+}
+
session "s2"
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
}
step "wrtwcte" { UPDATE table_a SET value = 'tableAValue2' WHERE id = 1; }
step "wrjt" { UPDATE jointest SET data = 42 WHERE id = 7; }
+step "complexpartupdate" {
+ with u as (update parttbl set a = a returning parttbl.*)
+ update parttbl set a = u.a from u;
+}
step "c2" { COMMIT; }
session "s3"
permutation "wrtwcte" "readwcte" "c1" "c2"
permutation "wrjt" "selectjoinforupdate" "c2" "c1"
permutation "wrtwcte" "multireadwcte" "c1" "c2"
+
+permutation "simplepartupdate" "complexpartupdate" "c1" "c2"