Bug#28269: FEDERATED engine fails to quote reserved words for \

	field names

Add a test that proves the bug is fixed.  This doesn't add any
new server code.
parent b80f0518
......@@ -14,6 +14,9 @@ Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` int NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
......@@ -22,6 +25,9 @@ Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` inT NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -29,6 +35,9 @@ CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1';
ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1:@/too/many/items/federated/t1' is not in the correct format
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` iNt NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -36,6 +45,9 @@ CONNECTION='mysql://root@127.0.0.1';
ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1' is not in the correct format
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` iNT NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -45,6 +57,9 @@ ERROR HY000: The foreign data source you are trying to reference does not exist.
DROP TABLE federated.t1;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` Int NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -54,16 +69,25 @@ ERROR HY000: Unable to connect to foreign data source: Access denied for user 'u
DROP TABLE federated.t1;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` InT NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
INSERT INTO federated.t1 (id, `group`) VALUES (3, 42);
INSERT INTO federated.t1 (id, `a\\b`) VALUES (4, 23);
INSERT INTO federated.t1 (id, `a\\`) VALUES (5, 1);
SELECT * FROM federated.t1;
id name
1 foo
2 fee
id group a\\b a\\ name
1 0 0 0 foo
2 0 0 0 fee
3 42 0 0
4 0 23 0
5 0 0 1
DELETE FROM federated.t1;
DROP TABLE federated.t1;
DROP TABLE IF EXISTS federated.t2;
......
......@@ -6,6 +6,9 @@ connection slave;
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` int NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
......@@ -16,6 +19,9 @@ DROP TABLE IF EXISTS federated.t1;
--error 1432
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` inT NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -25,6 +31,9 @@ CREATE TABLE federated.t1 (
--error 1432
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\b` iNt NOT NULL default 0,
`a\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -34,6 +43,9 @@ CREATE TABLE federated.t1 (
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\\\b` iNT NOT NULL default 0,
`a\\\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -46,6 +58,9 @@ DROP TABLE federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\\\b` Int NOT NULL default 0,
`a\\\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -58,6 +73,9 @@ DROP TABLE federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`group` int NOT NULL default 0,
`a\\\\b` InT NOT NULL default 0,
`a\\\\` int NOT NULL default 0,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
......@@ -65,6 +83,9 @@ eval CREATE TABLE federated.t1 (
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
INSERT INTO federated.t1 (id, `group`) VALUES (3, 42);
INSERT INTO federated.t1 (id, `a\\b`) VALUES (4, 23);
INSERT INTO federated.t1 (id, `a\\`) VALUES (5, 1);
SELECT * FROM federated.t1;
DELETE FROM federated.t1;
......
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