Bug #86001 Passing user defined variable throws error in replication commands.
Submitted: 19 Apr 2017 10:12
Reporter: NEHA KUMARI Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:8.0.1 OS:Any
Assigned to: CPU Architecture:Any

[19 Apr 2017 10:12] NEHA KUMARI
Description:
When an user defined variable is passed as an input to the following replication commands it throws error.
- RESET MASTER TO x:
- CHANGE MASTER;
- PURGE BINARY LOGS;
- CHANGE REPLICATION FILTER

How to repeat:
mysql> SET @binlog_to = floor(rand()*10000);
Query OK, 0 rows affected (0.00 sec)

mysql> RESET MASTER TO @binlog_to;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@binlog_to' at line 1
[20 Jul 2018 12:12] Jean-François Gagné
Hi,

this also affect 5.7.22 and START SLAVE UNTIL.  See details below.

My main motivation for having this would be to avoid having to type complex numbers twice when doing START SLAVE UNTIL and then MASTER_POS_WAIT.

Thanks for looking into that,

JFG

--------------------------------------------------

slave1 [localhost] {msandbox} ((none)) > SELECT @@version;
+------------+
| @@version  |
+------------+
| 5.7.22-log |
+------------+
1 row in set (0.00 sec)

slave1 [localhost] {msandbox} ((none)) > STOP SLAVBE;
Query OK, 0 rows affected (0.02 sec)

slave1 [localhost] {msandbox} ((none)) > SET @rmlf = 'mysql-bin.000001';
Query OK, 0 rows affected (0.00 sec)

slave1 [localhost] {msandbox} ((none)) > SET @emlp = 48484;
Query OK, 0 rows affected (0.00 sec)

slave1 [localhost] {msandbox} ((none)) > START SLAVE UNTIL MASTER_LOG_FILE = @rmlf, MASTER_LOG_POS = @emlp; SELECT MASTER_POS_WAIT(@rmlf, @emlp) as res;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@rmlf, MASTER_LOG_POS = @emlp' at line 1
+------+
| res  |
+------+
| NULL |
+------+
1 row in set (0.00 sec)

slave1 [localhost] {msandbox} ((none)) > START SLAVE UNTIL MASTER_LOG_FILE = 'mysql-bin.000001', MASTER_LOG_POS = 48484; SELECT MASTER_POS_WAIT(@rmlf, @emlp) as res;
Query OK, 0 rows affected, 1 warning (0.00 sec)

+------+
| res  |
+------+
| NULL |
+------+
1 row in set (1 min 22.21 sec)