diff options
-rw-r--r-- | mysql-test/r/select.result | 18 | ||||
-rw-r--r-- | mysql-test/t/select.test | 17 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 5 |
3 files changed, 40 insertions, 0 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index af0ef29bb53..57f650f4c56 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4970,3 +4970,21 @@ avg(distinct(t1.a)) 0 DROP TABLE t1; # End of test BUG#57203 +# +# Bug#63020: Function "format"'s 'locale' argument is not considered +# when creating a "view' +# +CREATE TABLE t1 (f1 DECIMAL(10,2)); +INSERT INTO t1 VALUES (11.67),(17865.3),(12345678.92); +CREATE VIEW view_t1 AS SELECT FORMAT(f1,1,'sk_SK') AS f1 FROM t1; +SHOW CREATE VIEW view_t1; +View Create View character_set_client collation_connection +view_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_t1` AS select format(`t1`.`f1`,1,'sk_SK') AS `f1` from `t1` latin1 latin1_swedish_ci +SELECT * FROM view_t1; +f1 +11,7 +17 865,3 +12 345 678,9 +DROP TABLE t1; +DROP VIEW view_t1; +# End of test BUG#63020 diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 043b03e4686..d9e9c27650f 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4236,3 +4236,20 @@ GROUP BY t2.a ORDER BY t1.a; DROP TABLE t1; --echo # End of test BUG#57203 + +--echo # +--echo # Bug#63020: Function "format"'s 'locale' argument is not considered +--echo # when creating a "view' +--echo # + +CREATE TABLE t1 (f1 DECIMAL(10,2)); +INSERT INTO t1 VALUES (11.67),(17865.3),(12345678.92); +CREATE VIEW view_t1 AS SELECT FORMAT(f1,1,'sk_SK') AS f1 FROM t1; +SHOW CREATE VIEW view_t1; +SELECT * FROM view_t1; + +DROP TABLE t1; +DROP VIEW view_t1; + +--echo # End of test BUG#63020 + diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a0fdb3cf811..86082f3d893 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2385,6 +2385,11 @@ void Item_func_format::print(String *str, enum_query_type query_type) args[0]->print(str, query_type); str->append(','); args[1]->print(str, query_type); + if(arg_count > 2) + { + str->append(','); + args[2]->print(str,query_type); + } str->append(')'); } |