SET optimizer_switch = REPLACE(...) causes ER_WRONG_VALUE_FOR_VAR
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Sergei Golubchik |
Bug Description
The following statement
SET optimizer_switch = REPLACE( @@optimizer_switch, '=off', '=on' )
as well as many other similar constructions, fails with ER_WRONG_
bzr version-info
revision-id: <email address hidden>
date: 2012-01-05 00:02:57 +0100
build-date: 2012-01-06 03:01:39 +0400
revno: 3203
branch-nick: maria-5.5
In 5.2 and 5.3 it works all right.
It does not seem to be about the value, since this way it works:
SET @a = REPLACE( @@optimizer_switch, '=off', '=on' );
SET optimizer_switch = @a;
But not this way
SET @b = @@optimizer_switch;
SET optimizer_switch = REPLACE( @b, '=off', '=on' );
It also does not seem to be about the result of REPLACE being too long, since this one works:
SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' )
REPLACE statements are a convenient way to set optimizer_switch to a needed value in tests, and keep it version-
Test case:
SET @saved_switch = @@optimizer_switch;
# This works
SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
SET optimizer_switch = @saved_switch;
# This doesn't
SET optimizer_switch = REPLACE( @@optimizer_switch, '=off', '=on' );
SET optimizer_switch = @saved_switch;
# This works
SET @a = REPLACE( @@optimizer_switch, '=off', '=on' );
SET optimizer_switch = @a;
SET optimizer_switch = @saved_switch;
# This doesn't
SET @b = @@optimizer_switch;
SET optimizer_switch = REPLACE( @b, '=off', '=on' );
Related branches
Changed in maria: | |
assignee: | serg (serg) → Sergei (sergii) |
Changed in maria: | |
status: | New → Fix Committed |
importance: | Undecided → High |
This bug has also been filed in JIRA as MDEV-69