Comment 0 for bug 705369

Revision history for this message
Philip Stoev (philip-stoev) wrote :

The following query:

UPDATE part RIGHT JOIN partsupp ON ( p_partkey = ps_partkey ) RIGHT JOIN supplier ON ( ps_suppkey = s_suppkey ) RIGHT JOIN nation ON ( s_nationkey = n_nationkey ) JOIN region ON ( n_regionkey = r_regionkey ) SET s_name = DEFAULT , r_comment = DEFAULT WHERE r_comment IS NOT NULL OR ps_suppkey BETWEEN 10 AND 14;

updates one row in supplier with table_elimination=on and no rows with table_elimination=off . Curiously, converting the UPDATE into an equivalent SELECT returns an empty result set.

Test case:

PREPARE p1 FROM "UPDATE part RIGHT JOIN partsupp ON ( p_partkey = ps_partkey ) RIGHT JOIN supplier ON ( ps_suppkey = s_suppkey ) RIGHT JOIN nation ON ( s_nationkey = n_nationkey ) JOIN region ON ( n_regionkey = r_regionkey ) SET s_name = DEFAULT , r_comment = DEFAULT WHERE r_comment IS NOT NULL OR ps_suppkey BETWEEN 10 AND 14;";
SET AUTOCOMMIT=OFF;
SET SESSION optimizer_switch = 'table_elimination=on';
START TRANSACTION;
EXECUTE p1;
SELECT s_name FROM supplier;
ROLLBACK;
SET SESSION optimizer_switch = 'table_elimination=off';
START TRANSACTION;
EXECUTE p1;
SELECT s_name FROM supplier;
ROLLBACK;

The dataset will be attached shortly. Please load with storage-engine=InnoDB