Details
Description
The original description can be found further in this field
The problem is reproducible with MySQL 5.1-5.6 and filed as http://bugs.mysql.com/bug.php?id=68135.
A variable can be created with an empty name. Apparently, it's confusing (see the original request below) and potentially error-prone; but it also causes problems with binary logging and replication:
SET @`` = 1;
CREATE TABLE t1 AS SELECT @`` AS f;
SHOW BINLOG EVENTS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
Consequently, replication fails with ER_SLAVE_RELAY_LOG_READ_FAILURE.
Currently it's only reproducible on maria/5.5, but not on maria/5.1, 5.2, 5.3 or 10.0-base. However, I suppose it's just a matter of time, since it came to maria/5.5 with the last mysql-5.1.67 merge, and it exists in all current trees of MySQL.
Test case:
--source include/master-slave.inc --source include/have_binlog_format_statement.inc SET @`` = 1; CREATE TABLE t1 AS SELECT @`` AS f; --sync_slave_with_master
==================================
Original description
I'm not sure if this is a bug or a feature request. Empty names seem to be allowed for variables. No warnings.
Empty names are not allowed for schemas, tables, columns, views, etc.
MariaDB [test]> SET @`` = 1;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> SELECT @``;
+------+
| @`` |
+------+
| 1 |
+------+
1 row in set (0.07 sec)
MariaDB [test]>
The same happens with local vars in stored routines:
DROP FUNCTION IF EXISTS `test`; CREATE FUNCTION `test`() RETURNS BOOLEAN BEGIN DECLARE `` TINYINT UNSIGNED; SET `` = 1; RETURN ``; END;
Gliffy Diagrams
Attachments
Issue Links
- is blocked by
-
MDEV-4333 5.5.31 merge
-
- Closed
-
- links to
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Hi Federico,
I suppose as a feature request it wouldn't stand much of a chance, not because it's unreasonable, but because it would almost inevitably cause compatibility issues – replication from an old slave to a new master, stored procedures which use an empty name, etc., and of course for MariaDb also compatibility with the upstream.
However, it turns out there is a bug with empty names, most likely a regression, which causes replication problems. I've updated the description and refiled it to MySQL bug base, and mentioned your request there, too. I doubt, however, that the bug will make Oracle forbid empty names, on the same reason of breaking compatibility with older versions; and if they don't, we can't either.
Thanks for the report, it revealed a serious issue.