[Commits] 964fe41: Fixed numbering for selects.

IgorBabaev igor at mariadb.com
Mon Apr 2 00:05:19 EEST 2018


revision-id: 964fe41410b5bf3665b5b8565e06001f8e6c2887 (mariadb-10.3.1-135-g964fe41)
parent(s): a2c52b0a63bf1bfb17827d33886f8f0ab109d085
author: Igor Babaev
committer: Igor Babaev
timestamp: 2018-04-01 14:05:19 -0700
message:

Fixed numbering for selects.

---
 mysql-test/r/cte_nonrecursive.result | 14 +++++++-------
 sql/sql_lex.cc                       |  2 ++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 907d53a..66051ce 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -151,8 +151,8 @@ with t as (select a from t1 where a<5)
 select * from t2 where c in (select a from t);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	4	
-1	PRIMARY	<subquery3>	eq_ref	distinct_key	distinct_key	4	func	1	
-3	MATERIALIZED	t1	ALL	NULL	NULL	NULL	NULL	8	Using where
+1	PRIMARY	<subquery2>	eq_ref	distinct_key	distinct_key	4	func	1	
+2	MATERIALIZED	t1	ALL	NULL	NULL	NULL	NULL	8	Using where
 explain
 select * from t2 
 where c in (select a from (select a from t1 where a<5) as t);
@@ -332,8 +332,8 @@ union
 select * from t where a >= 4;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	8	Using where
-3	UNION	t1	ALL	NULL	NULL	NULL	NULL	8	Using where
-NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	
+2	UNION	t1	ALL	NULL	NULL	NULL	NULL	8	Using where
+NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	
 explain
 select * from (select a from t1 where b >= 'c') as t
 where t.a < 2
@@ -461,10 +461,10 @@ t.c in (with t as (select * from t1 where t1.a<5)
 select t2.c from t2,t where t2.c=t.a);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	4	Using where
-1	PRIMARY	<subquery4>	eq_ref	distinct_key	distinct_key	4	func	1	
+1	PRIMARY	<subquery3>	eq_ref	distinct_key	distinct_key	4	func	1	
 1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	8	Using where; Using join buffer (flat, BNL join)
-4	MATERIALIZED	t2	ALL	NULL	NULL	NULL	NULL	4	Using where
-4	MATERIALIZED	t1	ALL	NULL	NULL	NULL	NULL	8	Using where; Using join buffer (flat, BNL join)
+3	MATERIALIZED	t2	ALL	NULL	NULL	NULL	NULL	4	Using where
+3	MATERIALIZED	t1	ALL	NULL	NULL	NULL	NULL	8	Using where; Using join buffer (flat, BNL join)
 explain
 select t1.a,t1.b from t1, (select c from t2 where c >= 4) as t
 where t1.a=t.c and
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index b7fc841..b12341d 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -3569,6 +3569,8 @@ void LEX::fix_first_select_number()
     {
       if (sel->select_number < num)
         sel->select_number++;
+      if (sel->select_number > num)
+        sel->select_number--;
     }
     first->select_number= 1;
   }


More information about the commits mailing list