SET STATEMENT incorrectly works on second prepared statement execution

Bug #1333650 reported by Oleksandr "Sanja" Byelkin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Invalid
Undecided
Unassigned
5.6
Triaged
High
Unassigned
5.7
Triaged
High
Unassigned

Bug Description

Here is a test suite:

set session binlog_format=mixed;
PREPARE stmt1 FROM 'set statement binlog_format=row for SELECT @@binlog_format';
execute stmt1;
execute stmt1;
deallocate prepare stmt1;

Result of the execution is:

set session binlog_format=mixed;
PREPARE stmt1 FROM 'set statement binlog_format=row for SELECT @@binlog_format';
execute stmt1;
@@binlog_format
ROW
execute stmt1;
@@binlog_format
MIXED
deallocate prepare stmt1;

Revision history for this message
Oleksandr "Sanja" Byelkin (sanja-byelkin) wrote :

I forgot to mention that it is 5.6 server

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

Thank you for the problem report. It's easy to confirm:

[openxs@centos ~]$ mysql -uroot test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.17-66.0 Percona Server (GPL), Release 66.0, Revision 608

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set session binlog_format=mixed;
Query OK, 0 rows affected (0.00 sec)

mysql> PREPARE stmt1 FROM 'set statement binlog_format=row for SELECT @@binlog_format';
Query OK, 0 rows affected (0.00 sec)
Statement prepared

mysql> execute stmt1;
+-----------------+
| @@binlog_format |
+-----------------+
| ROW |
+-----------------+
1 row in set (0.00 sec)

mysql> execute stmt1;
+-----------------+
| @@binlog_format |
+-----------------+
| MIXED |
+-----------------+
1 row in set (0.00 sec)

mysql> deallocate prepare stmt1;
Query OK, 0 rows affected (0.00 sec)

Revision history for this message
Oleksandr "Sanja" Byelkin (sanja-byelkin) wrote :

It is how to fix it:
    while ((var=(set_var *)it++))
    {
      var->var->stmt_update(thd);
    }

    //thd->lex->set_statement= false;
  }

tags: added: set-statement
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-798

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.