Skip to content

Commit

Permalink
store/show vcols as item->print()
Browse files Browse the repository at this point in the history
otherwise we'd need to store sql_mode *per vcol*
(consider CREATE INDEX...) and how SHOW CREATE TABLE would
support that?

Additionally, get rid of vcol::expr_str, just to make sure
the string is always generated and never leaked in the
original form.
  • Loading branch information
vuvova committed Dec 12, 2016
1 parent 8b3b6dc commit a411d7f
Show file tree
Hide file tree
Showing 132 changed files with 2,094 additions and 2,195 deletions.
4 changes: 2 additions & 2 deletions mysql-test/r/alter_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -2073,8 +2073,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `min` CHECK (a+b > 100),
CONSTRAINT `mini` CHECK (a+b > 100)
CONSTRAINT `min` CHECK (((`a` + `b`) > 100)),
CONSTRAINT `mini` CHECK (((`a` + `b`) > 100))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(a INT, b INT, CONSTRAINT min check (a>5),
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/cast.result
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(5) AS (cast("a" as char(10) binary) + a) VIRTUAL
`b` char(5) AS ((cast('a' as char(10) charset latin1) + `a`)) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select collation(cast("a" as char(10) binary));
Expand Down
54 changes: 27 additions & 27 deletions mysql-test/r/check_constraint.result
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ create table t1 (a int check(a>10), b int check (b > 20), constraint `min` check
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL CHECK (a>10),
`b` int(11) DEFAULT NULL CHECK (b > 20),
CONSTRAINT `min` CHECK (a+b > 100),
CONSTRAINT `max` CHECK (a+b <500)
`a` int(11) DEFAULT NULL CHECK ((`a` > 10)),
`b` int(11) DEFAULT NULL CHECK ((`b` > 20)),
CONSTRAINT `min` CHECK (((`a` + `b`) > 100)),
CONSTRAINT `max` CHECK (((`a` + `b`) < 500))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (100,100);
insert into t1 values (1,1);
Expand Down Expand Up @@ -52,12 +52,12 @@ set check_constraint_checks=@save_check_constraint;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL CHECK (a>10),
`b` int(11) DEFAULT NULL CHECK (b > 20),
`c` int(11) DEFAULT 0 CHECK (c < 10),
CONSTRAINT `min` CHECK (a+b > 100),
CONSTRAINT `max` CHECK (a+b <500),
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
`a` int(11) DEFAULT NULL CHECK ((`a` > 10)),
`b` int(11) DEFAULT NULL CHECK ((`b` > 20)),
`c` int(11) DEFAULT 0 CHECK ((`c` < 10)),
CONSTRAINT `min` CHECK (((`a` + `b`) > 100)),
CONSTRAINT `max` CHECK (((`a` + `b`) < 500)),
CONSTRAINT `CONSTRAINT_1` CHECK ((((`a` + `b`) + `c`) < 500))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values(105,105,105);
ERROR 23000: CONSTRAINT `c` failed for `test`.`t1`
Expand All @@ -75,12 +75,12 @@ create table t2 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL CHECK (a>10),
`b` int(11) DEFAULT NULL CHECK (b > 20),
`c` int(11) DEFAULT 0 CHECK (c < 10),
CONSTRAINT `min` CHECK (a+b > 100),
CONSTRAINT `max` CHECK (a+b <500),
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
`a` int(11) DEFAULT NULL CHECK ((`a` > 10)),
`b` int(11) DEFAULT NULL CHECK ((`b` > 20)),
`c` int(11) DEFAULT 0 CHECK ((`c` < 10)),
CONSTRAINT `min` CHECK (((`a` + `b`) > 100)),
CONSTRAINT `max` CHECK (((`a` + `b`) < 500)),
CONSTRAINT `CONSTRAINT_1` CHECK ((((`a` + `b`) + `c`) < 500))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t2 drop constraint c;
ERROR 42000: Can't DROP CONSTRAINT `c`; check that it exists
Expand All @@ -91,11 +91,11 @@ alter table t2 drop constraint min;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL CHECK (a>10),
`b` int(11) DEFAULT NULL CHECK (b > 20),
`c` int(11) DEFAULT 0 CHECK (c < 10),
CONSTRAINT `max` CHECK (a+b <500),
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
`a` int(11) DEFAULT NULL CHECK ((`a` > 10)),
`b` int(11) DEFAULT NULL CHECK ((`b` > 20)),
`c` int(11) DEFAULT 0 CHECK ((`c` < 10)),
CONSTRAINT `max` CHECK (((`a` + `b`) < 500)),
CONSTRAINT `CONSTRAINT_1` CHECK ((((`a` + `b`) + `c`) < 500))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
create or replace table t1 (a int, b int, constraint check (a>b));
Expand All @@ -104,7 +104,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (a>b)
CONSTRAINT `CONSTRAINT_1` CHECK ((`a` > `b`))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create or replace table t1 (a int, b int,
constraint CONSTRAINT_1 check (a>1),
Expand All @@ -114,8 +114,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (a>1),
CONSTRAINT `CONSTRAINT_2` CHECK (b>1)
CONSTRAINT `CONSTRAINT_1` CHECK ((`a` > 1)),
CONSTRAINT `CONSTRAINT_2` CHECK ((`b` > 1))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create or replace table t1 (a int, b int,
constraint CONSTRAINT_1 check (a>1),
Expand All @@ -126,8 +126,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (a>1),
CONSTRAINT `CONSTRAINT_3` CHECK (b>1),
CONSTRAINT `CONSTRAINT_2` CHECK (a>b)
CONSTRAINT `CONSTRAINT_1` CHECK ((`a` > 1)),
CONSTRAINT `CONSTRAINT_3` CHECK ((`b` > 1)),
CONSTRAINT `CONSTRAINT_2` CHECK ((`a` > `b`))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
6 changes: 3 additions & 3 deletions mysql-test/r/constraints.result
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ create table t1 (a int check (a>0));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL CHECK (a>0)
`a` int(11) DEFAULT NULL CHECK ((`a` > 0))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1);
insert into t1 values (0);
Expand All @@ -15,7 +15,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (a>b)
CONSTRAINT `CONSTRAINT_1` CHECK ((`a` > `b`))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0);
insert into t1 values (0,1);
Expand All @@ -27,7 +27,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `abc` CHECK (a>b)
CONSTRAINT `abc` CHECK ((`a` > `b`))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0);
insert into t1 values (0,1);
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/r/create.result
Original file line number Diff line number Diff line change
Expand Up @@ -1866,8 +1866,8 @@ Thinkpad Laptop black ttt
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`color` char(32) AS (COLUMN_GET(dynamic_cols, 1 as char)) PERSISTENT,
`cl` char(32) AS (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) PERSISTENT,
`color` char(32) AS (column_get(`dynamic_cols`,1 as char charset latin1)) PERSISTENT,
`cl` char(32) AS (column_get(column_add(column_create(1,'blue' AS char charset latin1 ),2,'ttt'),`i` as char charset latin1)) PERSISTENT,
`item_name` varchar(32) NOT NULL,
`i` int(11) DEFAULT NULL,
`dynamic_cols` blob DEFAULT NULL,
Expand All @@ -1888,7 +1888,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`n` int(11) DEFAULT NULL,
`c` char(32) AS (convert(cast(n as char), char)) PERSISTENT
`c` char(32) AS (cast(cast(`n` as char charset latin1) as char charset latin1)) PERSISTENT
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @@session.collation_server=filename;
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/r/ctype_binary.result
Original file line number Diff line number Diff line change
Expand Up @@ -2869,11 +2869,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())`
Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/r/ctype_cp1251.result
Original file line number Diff line number Diff line change
Expand Up @@ -3278,11 +3278,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),now()) AS `CONCAT(v_LastPaymentDate, NOW())`
Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/r/ctype_latin1.result
Original file line number Diff line number Diff line change
Expand Up @@ -3575,11 +3575,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())`
Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/r/ctype_like_range.result
Original file line number Diff line number Diff line change
Expand Up @@ -4419,8 +4419,8 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(10) DEFAULT NULL,
`mn` varchar(10) DEFAULT LIKE_RANGE_MIN(a,10),
`mx` varchar(10) DEFAULT LIKE_RANGE_MAX(a,10)
`mn` varchar(10) DEFAULT like_range_min(`a`,10),
`mx` varchar(10) DEFAULT like_range_max(`a`,10)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (a) VALUES ('a'),('a_'),('a%');
SELECT a, HEX(mn), HEX(mx) FROM t1;
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/r/ctype_ucs.result
Original file line number Diff line number Diff line change
Expand Up @@ -4478,11 +4478,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(now() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())`
Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(current_timestamp() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
Expand Down
18 changes: 9 additions & 9 deletions mysql-test/r/ctype_utf8.result
Original file line number Diff line number Diff line change
Expand Up @@ -5320,11 +5320,11 @@ NULL
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()`
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),now()) AS `CONCAT(v_LastPaymentDate, NOW())`
Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())`
DROP PROCEDURE p1;
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
Expand Down Expand Up @@ -10515,7 +10515,7 @@ SET NAMES utf8;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(30) DEFAULT CONCAT('ß')
`a` varchar(30) DEFAULT concat('ß')
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (DEFAULT);
SELECT HEX(a),a FROM t1;
Expand All @@ -10528,9 +10528,9 @@ ALTER TABLE t1 ADD c VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(30) DEFAULT CONCAT('ß'),
`b` varchar(30) DEFAULT CONCAT('ß'),
`c` varchar(30) DEFAULT CONCAT('ß')
`a` varchar(30) DEFAULT concat('ß'),
`b` varchar(30) DEFAULT concat('ß'),
`c` varchar(30) DEFAULT concat('ß')
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DELETE FROM t1;
INSERT INTO t1 VALUES();
Expand All @@ -10551,7 +10551,7 @@ SET NAMES utf8;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')
`a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß')
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (DEFAULT);
SELECT HEX(a), a FROM t1;
Expand All @@ -10563,7 +10563,7 @@ CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(30) DEFAULT CONCAT('ß')
`a` varchar(30) DEFAULT concat('ß')
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (DEFAULT);
SELECT HEX(a) FROM t1;
Expand All @@ -10575,7 +10575,7 @@ CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')
`a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß')
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (DEFAULT);
SELECT HEX(a) FROM t1;
Expand Down
Loading

0 comments on commit a411d7f

Please sign in to comment.