From: Date: January 12 2007 11:49am Subject: bk commit into 5.1 tree (gluh:1.2388) List-Archive: http://lists.mysql.com/commits/18017 Message-Id: <20070112104905.1D03524A007A@eagle.localdomain> Below is the list of changes that have just been committed into a local 5.1 repository of gluh. When gluh does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-01-12 14:48:59+04:00, gluh@eagle.(none) +7 -0 Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt into mysql.com:/home/gluh/MySQL/Merge/5.1-opt MERGE: 1.1810.2362.53 mysql-test/r/join.result@stripped, 2007-01-12 14:48:58+04:00, gluh@eagle.(none) +16 -16 manual merge MERGE: 1.38.1.2 mysql-test/r/order_by.result@stripped, 2007-01-12 14:47:54+04:00, gluh@eagle.(none) +0 -0 Auto merged MERGE: 1.55.1.4 mysql-test/t/join.test@stripped, 2007-01-12 14:48:58+04:00, gluh@eagle.(none) +18 -20 manual merge MERGE: 1.32.1.3 mysql-test/t/order_by.test@stripped, 2007-01-12 14:47:54+04:00, gluh@eagle.(none) +0 -0 Auto merged MERGE: 1.41.1.1 sql/item.cc@stripped, 2007-01-12 14:47:54+04:00, gluh@eagle.(none) +0 -0 Auto merged MERGE: 1.113.1.135 sql/mysqld.cc@stripped, 2007-01-12 14:47:54+04:00, gluh@eagle.(none) +0 -0 Auto merged MERGE: 1.439.83.1 sql/sql_base.cc@stripped, 2007-01-12 14:47:55+04:00, gluh@eagle.(none) +0 -0 Auto merged MERGE: 1.235.1.128 # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: gluh # Host: eagle.(none) # Root: /home/gluh/MySQL/Merge/5.1-opt/RESYNC --- 1.227/sql/item.cc 2006-12-31 04:06:34 +04:00 +++ 1.228/sql/item.cc 2007-01-12 14:47:54 +04:00 @@ -3732,6 +3732,8 @@ bool Item_field::fix_fields(THD *thd, It Item** res= find_item_in_list(this, thd->lex->current_select->item_list, &counter, REPORT_EXCEPT_NOT_FOUND, ¬_used); + if (!res) + return 1; if (res != (Item **)not_found_item) { if ((*res)->type() == Item::FIELD_ITEM) --- 1.373/sql/sql_base.cc 2007-01-12 13:34:31 +04:00 +++ 1.374/sql/sql_base.cc 2007-01-12 14:47:55 +04:00 @@ -3801,6 +3801,19 @@ find_field_in_natural_join(THD *thd, TAB column reference. See create_view_field() for details. */ item= nj_col->create_item(thd); + /* + *ref != NULL means that *ref contains the item that we need to + replace. If the item was aliased by the user, set the alias to + the replacing item. + We need to set alias on both ref itself and on ref real item. + */ + if (*ref && !(*ref)->is_autogenerated_name) + { + item->set_name((*ref)->name, (*ref)->name_length, + system_charset_info); + item->real_item()->set_name((*ref)->name, (*ref)->name_length, + system_charset_info); + } if (register_tree_change && arena) thd->restore_active_arena(arena, &backup); --- 1.42/mysql-test/r/join.result 2006-11-13 20:08:23 +04:00 +++ 1.43/mysql-test/r/join.result 2007-01-12 14:48:58 +04:00 @@ -804,3 +804,19 @@ select '^^: The above should be ~= 20 + Z ^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error drop table t1, t2; +CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50)); +CREATE TABLE t2 (Test_ID INTEGER); +CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1; +CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2 +USING (Test_ID); +DESCRIBE tv1; +Field Type Null Key Default Extra +Name varchar(50) YES NULL +CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2 +ON v1.Test_ID = t2.Test_ID; +DESCRIBE tv2; +Field Type Null Key Default Extra +Name varchar(50) YES NULL +DROP VIEW v1; +DROP TABLE t1,t2,tv1,tv2; +End of 5.0 tests. --- 1.59/mysql-test/r/order_by.result 2006-11-19 22:19:48 +04:00 +++ 1.60/mysql-test/r/order_by.result 2007-01-12 14:47:54 +04:00 @@ -29,14 +29,14 @@ INSERT INTO t2 VALUES (7,'Liste des t2', INSERT INTO t2 VALUES (8,'Consulter les soumissions','consulter_soumissions.phtml',200,'link.gif'); INSERT INTO t2 VALUES (9,'Ajouter un type de materiel','typeMateriel_ajoute_form.phtml',51000,'link.gif'); INSERT INTO t2 VALUES (10,'Lister/modifier un type de materiel','typeMateriel_liste_form.phtml',51010,'link.gif'); -INSERT INTO t2 VALUES (3,'Créer une fiche de client','clients_ajoute_form.phtml',40000,'link.gif'); +INSERT INTO t2 VALUES (3,'Créer une fiche de client','clients_ajoute_form.phtml',40000,'link.gif'); INSERT INTO t2 VALUES (4,'Modifier des clients','en_construction.html',40010,'link.gif'); INSERT INTO t2 VALUES (5,'Effacer des clients','en_construction.html',40020,'link.gif'); INSERT INTO t2 VALUES (6,'Ajouter un service','t2_ajoute_form.phtml',51050,'link.gif'); select t1.id,t1.idservice,t2.ordre,t2.description from t1, t2 where t1.id = 2 and t1.idservice = t2.id order by t2.ordre; id idservice ordre description 2 1 10 Emettre un appel d'offres -2 3 40000 Créer une fiche de client +2 3 40000 Créer une fiche de client 2 4 40010 Modifier des clients 2 5 40020 Effacer des clients 2 6 51050 Ajouter un service @@ -873,6 +873,14 @@ num (select num + 2 FROM t1 LIMIT 1) 3 5 SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a; ERROR 42S22: Unknown column 'num' in 'on clause' +DROP TABLE t1; +CREATE TABLE t1 (a int); +SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1; +val val1 +SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val; +ERROR 23000: Column 'val' in order clause is ambiguous +SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1; +ERROR 23000: Column 'val' in order clause is ambiguous DROP TABLE t1; create table t1 (a int not null, b int not null, c int not null); insert t1 values (1,1,1),(1,1,2),(1,2,1); --- 1.38/mysql-test/t/join.test 2006-12-26 19:56:17 +04:00 +++ 1.39/mysql-test/t/join.test 2007-01-12 14:48:58 +04:00 @@ -631,3 +631,21 @@ select '^^: The above should be ~= 20 + drop table t1, t2; +# BUG#25106: A USING clause in combination with a VIEW results in column +# aliases ignored +# +CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50)); +CREATE TABLE t2 (Test_ID INTEGER); +CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1; + +CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2 + USING (Test_ID); +DESCRIBE tv1; +CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2 + ON v1.Test_ID = t2.Test_ID; +DESCRIBE tv2; + +DROP VIEW v1; +DROP TABLE t1,t2,tv1,tv2; + +--echo End of 5.0 tests. --- 1.42/mysql-test/t/order_by.test 2006-11-19 22:25:00 +04:00 +++ 1.43/mysql-test/t/order_by.test 2007-01-12 14:47:54 +04:00 @@ -44,7 +44,7 @@ INSERT INTO t2 VALUES (7,'Liste des t2', INSERT INTO t2 VALUES (8,'Consulter les soumissions','consulter_soumissions.phtml',200,'link.gif'); INSERT INTO t2 VALUES (9,'Ajouter un type de materiel','typeMateriel_ajoute_form.phtml',51000,'link.gif'); INSERT INTO t2 VALUES (10,'Lister/modifier un type de materiel','typeMateriel_liste_form.phtml',51010,'link.gif'); -INSERT INTO t2 VALUES (3,'Créer une fiche de client','clients_ajoute_form.phtml',40000,'link.gif'); +INSERT INTO t2 VALUES (3,'Créer une fiche de client','clients_ajoute_form.phtml',40000,'link.gif'); INSERT INTO t2 VALUES (4,'Modifier des clients','en_construction.html',40010,'link.gif'); INSERT INTO t2 VALUES (5,'Effacer des clients','en_construction.html',40020,'link.gif'); INSERT INTO t2 VALUES (6,'Ajouter un service','t2_ajoute_form.phtml',51050,'link.gif'); @@ -586,6 +586,21 @@ SELECT a + 1 AS num, num + 1 FROM t1; SELECT a + 1 AS num, (select num + 2 FROM t1 LIMIT 1) FROM t1; --error 1054 SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a; +DROP TABLE t1; + +# +# Bug #25427: crash when order by expression contains a name +# that cannot be resolved unambiguously +# + +CREATE TABLE t1 (a int); + +SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1; +--error 1052 +SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val; +--error 1052 +SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1; + DROP TABLE t1; # End of 4.1 tests