Skip to content

Commit

Permalink
test for ALTER TABLE ... SET DEFAULT
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Jun 30, 2016
1 parent 3687ede commit 80de816
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mysql-test/r/default.result
Original file line number Diff line number Diff line change
Expand Up @@ -3076,3 +3076,23 @@ a b c
1 2 1
1 2 NULL
drop table t1;
create table t1 (a int default 1, b int default (1+1), c int);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT '1',
`b` int(11) DEFAULT (1+1),
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 alter a set default (2+3), alter b set default 4,
alter c set default (-a);
alter table t1 alter a set default 1+2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '+2' at line 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT (2+3),
`b` int(11) DEFAULT '4',
`c` int(11) DEFAULT (-a)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
12 changes: 12 additions & 0 deletions mysql-test/t/default.test
Original file line number Diff line number Diff line change
Expand Up @@ -1849,3 +1849,15 @@ insert t1 (c) values (a);
insert t1 (c) values (b);
select * from t1;
drop table t1;

#
# ALTER ... SET DEFAULT
#
create table t1 (a int default 1, b int default (1+1), c int);
show create table t1;
alter table t1 alter a set default (2+3), alter b set default 4,
alter c set default (-a);
--error ER_PARSE_ERROR
alter table t1 alter a set default 1+2;
show create table t1;
drop table t1;

0 comments on commit 80de816

Please sign in to comment.