Goal:

Goal of today is to fix updatability of tests in main.view with merging allowed for multi update.

// Code referenced in the report
create table t2 (s1 int);
insert into t2 values (1),(2),(3);
CREATE VIEW v2 AS SELECT s1,s2 FROM (SELECT s1 as s2 FROM t2) x, t2 WHERE t2.s1=x.s2;

update v2 set s1=s1+1; // 1
update v2 set s2=s2+1; // 2

→ First problem I was facing was that query #2 (see above) was crashing the server instead of throwing an error.

→ So, I added a check that "If we are trying to update column , it must not be an alias of other column" which can be seen in function 'check_updatable_fields'.

→ After making all the changes and updating few test cases because of mergeability, 3 tests were failing because of mergeability.

Tests failing:

  1. main.cte_dml_stmt

  2. main.cte_nonrecursive — "update v1 set a=0 where a > 4" is badly written test case in my opinion. It succeeded but it should fail. you may be asking why? because a>4 have 0 rows to be updated but if we change that to a > 3, test fails in similar condition as above given test.

  3. main.lock_multi_bug38499 — couldn't find why it was failing, will check later.

Let me know what to do about these failed tests.

Changes can be seen here:

https://github.com/rahulanand16nov/server/commit/455ab8f1d13c10a13d5028657a87a2be3c7a9e14

Result: