From 4c02004da9ca0037731338c0fdd3fae8853de459 Mon Sep 17 00:00:00 2001 From: "igor@olga.mysql.com" <> Date: Wed, 4 Jul 2007 21:12:07 -0700 Subject: Fixed bug #29392. This bug may manifest itself for select queries over a multi-table view that includes an ORDER BY clause in its definition. If the select list of the query contains references to the same view column with different aliases the names of the columns in the result output will be nevertheless the same, coinciding with one of the alias. The bug happened because the method Item_ref::get_tmp_table_item that was inherited by the class Item_direct_view_ref ignored the fact that the name of the view column reference must be inherited by the fields of the temporary table that was created in order to get the result rows sorted. --- mysql-test/t/view.test | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index f670ac8a49d..c7f722a18a5 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3348,4 +3348,59 @@ EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a; DROP VIEW v1; DROP TABLE t1; +# +# Bug #29392: SELECT over a multi-table view with ORDER BY +# selecting the same view column with two different aliases +# + +CREATE TABLE t1 ( + person_id int NOT NULL PRIMARY KEY, + username varchar(40) default NULL, + status_flg char(1) NOT NULL default 'A' +); + +CREATE TABLE t2 ( + person_role_id int NOT NULL auto_increment PRIMARY KEY, + role_id int NOT NULL, + person_id int NOT NULL, + INDEX idx_person_id (person_id), + INDEX idx_role_id (role_id) +); + +CREATE TABLE t3 ( + role_id int NOT NULL auto_increment PRIMARY KEY, + role_name varchar(100) default NULL, + app_name varchar(40) NOT NULL, + INDEX idx_app_name(app_name) +); + +CREATE VIEW v1 AS +SELECT profile.person_id AS person_id + FROM t1 profile, t2 userrole, t3 role + WHERE userrole.person_id = profile.person_id AND + role.role_id = userrole.role_id AND + profile.status_flg = 'A' + ORDER BY profile.person_id,role.app_name,role.role_name; + +INSERT INTO t1 VALUES + (6,'Sw','A'), (-1136332546,'ols','e'), (0,' *\n','0'), + (-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0'); + +INSERT INTO t2 VALUES + (1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10); + +INSERT INTO t3 VALUES + (1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'), + (3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'), + (5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'), + (7,'SOC_USER','SOCCANS'),(8,'CAYIT_USER','CAYITCANS'), + (9,'RTOS_DCFSPOS_SUPERVISOR','RTOS'); + +EXPLAIN SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; +SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; + +DROP VIEW v1; +DROP TABLE t1,t2,t3; + --echo End of 5.0 tests. + -- cgit v1.2.1 From 1532452a00e49a71880707f4ae279d19aab14724 Mon Sep 17 00:00:00 2001 From: "gkodinov/kgeorge@magare.gmz" <> Date: Thu, 5 Jul 2007 18:24:48 +0300 Subject: Bug #29166: AsText() needs to know the maximum number of characters a IEEE double precision value can occupy to make sure there's enough buffer space. The number was too small to hold all possible values and this caused buffer overruns. Fixed by correcting the calculation of the maximum digits in a string representation of an IEEE double precision value as printed by String::qs_append(double). --- mysql-test/t/gis.test | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 95ccc6272e2..79743a0b8f4 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -570,4 +570,24 @@ create table t2 as select f2 as a from t1 union select f3 from t1; desc t2; select AsText(a) from t2; drop table t1, t2; + +# +# Bug #29166: MYsql crash when query is run +# + +# The test query itself is not logged : too large output. +# The real test is the second query : see if the first hasn't crashed the +# server +--disable_query_log +--disable_result_log +SELECT AsText(GeometryFromText(CONCAT( + 'MULTIPOLYGON(((', + REPEAT ('-0.00000000001234567890123456789012 -0.123456789012345678,', 1000), + '-0.00000000001234567890123456789012 -0.123456789012345678', + ')))' +))) AS a; +--enable_result_log +--enable_query_log +SELECT 1; + --echo End of 5.0 tests -- cgit v1.2.1 From c33f4d3d85fdbedd21e9b9830341b7e3e3434151 Mon Sep 17 00:00:00 2001 From: "gshchepa/uchum@gleb.loc" <> Date: Fri, 6 Jul 2007 03:43:23 +0500 Subject: Fixed bug #29442. The SELECT INTO OUTFILE FIELDS ENCLOSED BY digit or minus sign, followed by the same LOAD DATA INFILE statement, used wrond encoding of non-string fields contained the enclosed character in their text representation. Example: SELECT 15, 9 INTO OUTFILE 'text' FIELDS ENCLOSED BY '5'; Old encoded result in the text file: 5155 595 ^ was decoded as the 1st enclosing character of the 2nd field; ^ was skipped as garbage; ^ ^ was decoded as a pair of englosing characters of the 1st field; ^ was decoded as traling space of the first field; ^^ was decoded as a doubled enclosed character. New encoded result in the text file: 51\55 595 ^ ^ pair of enclosing characters of the 1st field; ^^ escaped enclosed character. --- mysql-test/t/loaddata.test | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index cdd3bb80b6e..260e760e7b3 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -213,4 +213,29 @@ select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1; --exec rm $MYSQLTEST_VARDIR/tmp/t2 drop table t1,t2; +# +# Bug#29442: SELECT INTO OUTFILE FIELDS ENCLOSED BY digit, minus sign etc +# corrupts non-string fields containing this character. +# + +CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE); + +INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100); +SELECT * FROM t1; + +--exec rm -f $MYSQLTEST_VARDIR/tmp/t1 +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1; +--exec cat $MYSQLTEST_VARDIR/tmp/t1 +--exec echo EOF + +TRUNCATE t1; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-'; +SELECT * FROM t1; + +--exec rm $MYSQLTEST_VARDIR/tmp/t1 +DROP TABLE t1; + # End of 5.0 tests -- cgit v1.2.1