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
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue is caused by |
Description |
{noformat:title=10.7.0 53b2c1f4664a3cb90f583979d9aa2771b7e1c98d (Debug)}
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) {noformat} |
{noformat:title=10.7.0 53b2c1f4664a3cb90f583979d9aa2771b7e1c98d (Debug) preview-10.7- 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) {noformat} |
Component/s | Server [ 13907 ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Summary | SFORMAT Does not allow @variable use (Warning 4183 SFORMAT error: invalid type specifier) | SFORMAT Does not allow @variable use |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Assignee | Sergei Golubchik [ serg ] | Alexander Barkov [ bar ] |
Status | Confirmed [ 10101 ] | In Review [ 10002 ] |
Assignee | Alexander Barkov [ bar ] | Sergei Golubchik [ serg ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.7.1 [ 26120 ] | |
Fix Version/s | 10.7 [ 24805 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Component/s | Character Sets [ 10801 ] |
Workflow | MariaDB v3 [ 125166 ] | MariaDB v4 [ 159700 ] |
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.