Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.7(EOL)
-
None
Description
10.7.0 53b2c1f4664a3cb90f583979d9aa2771b7e1c98d (Debug) preview-10.7-MDEV-25015-sformat |
10.7.0-dbg>SET @a=3.14;
|
Query OK, 0 rows affected (0.000 sec)
|
|
10.7.0-dbg>CREATE TABLE t1 SELECT @a;
|
Query OK, 1 row affected (0.019 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
|
10.7.0-dbg>SHOW CREATE TABLE t1\G
|
*************************** 1. row ***************************
|
Table: t1
|
Create Table: CREATE TABLE `t1` (
|
`@a` decimal(65,38) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
1 row in set (0.000 sec)
|
|
10.7.0-dbg>SELECT SFORMAT ('FLOAT {:.5f}',@a);
|
+-----------------------------+
|
| SFORMAT ('FLOAT {:.5f}',@a) |
|
+-----------------------------+
|
| NULL |
|
+-----------------------------+
|
1 row in set, 1 warning (0.000 sec)
|
|
10.7.0-dbg>SHOW WARNINGS;
|
+---------+------+---------------------------------------+
|
| Level | Code | Message |
|
+---------+------+---------------------------------------+
|
| Warning | 4183 | SFORMAT error: invalid type specifier |
|
+---------+------+---------------------------------------+
|
1 row in set (0.000 sec)
|
|
10.7.0-dbg>SELECT SFORMAT ('FLOAT {:.5f}',3.14);
|
+-------------------------------+
|
| SFORMAT ('FLOAT {:.5f}',3.14) |
|
+-------------------------------+
|
| FLOAT 3.14000 |
|
+-------------------------------+
|
1 row in set (0.000 sec)
|
Attachments
Issue Links
- is caused by
-
MDEV-25015 Custom formatting of strings in MariaDB queries
-
- Closed
-
please, take a look at the commit
commit e800625d80c
Author: Sergei Golubchik <serg@mariadb.org>
Date: Sat Oct 9 16:00:13 2021 +0200
MDEV-26646 SFORMAT Does not allow @variable use
If charset aggregation decides to convert arguments to some specific
charset and some arguments are numbers, they'll be wrapped into a
Item_func_conv_charset(), that changes result_type() to STRING_RESULT.
Fix: don't convert numbers, sformat needs their numerical value only.
I'm particularly interested in alternative approaches, e.g. pass a flag MY_COLL_SKIP_NUMBERS. Or just always skip numbers everywhere unconditionally.