Commit a07de253 authored by unknown's avatar unknown

Fix for bug #5887 "Triggers with string literals cause errors"

Fixed small error in new .FRM parser which caused it to handle 
improperly escaped strings.


mysql-test/r/trigger.result:
  Added test for bug #5887 "Triggers with string literals cause errors".
mysql-test/t/trigger.test:
  Added test for bug #5887 "Triggers with string literals cause errors".
sql/parse_file.cc:
  read_escaped_string(): We should not fail when we meet \' sequence 
  in escaped string.
parent 2c0e4789
...@@ -169,3 +169,8 @@ create temporary table t1 (i int); ...@@ -169,3 +169,8 @@ create temporary table t1 (i int);
create trigger trg before insert on t1 for each row set @a:=1; create trigger trg before insert on t1 for each row set @a:=1;
ERROR HY000: Trigger's 't1' is view or temporary table ERROR HY000: Trigger's 't1' is view or temporary table
drop table t1; drop table t1;
create table t1 (x1col char);
create trigger tx1 before insert on t1 for each row set new.x1col = 'x';
insert into t1 values ('y');
drop trigger t1.tx1;
drop table t1;
...@@ -193,3 +193,17 @@ create temporary table t1 (i int); ...@@ -193,3 +193,17 @@ create temporary table t1 (i int);
--error 1361 --error 1361
create trigger trg before insert on t1 for each row set @a:=1; create trigger trg before insert on t1 for each row set @a:=1;
drop table t1; drop table t1;
#
# Tests for various trigger-related bugs
#
# Test for bug #5887 "Triggers with string literals cause errors".
# New .FRM parser was not handling escaped strings properly.
create table t1 (x1col char);
create trigger tx1 before insert on t1 for each row set new.x1col = 'x';
insert into t1 values ('y');
drop trigger t1.tx1;
drop table t1;
...@@ -502,6 +502,7 @@ read_escaped_string(char *ptr, char *eol, LEX_STRING *str) ...@@ -502,6 +502,7 @@ read_escaped_string(char *ptr, char *eol, LEX_STRING *str)
break; break;
case '\'': case '\'':
*write_pos= '\''; *write_pos= '\'';
break;
default: default:
return TRUE; return TRUE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment