Files
tidb/tests/integrationtest/t/ddl/column.test

47 lines
1.6 KiB
Plaintext

# TestGetDefaultValueOfColumn
drop table if exists t1;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03', ti time default '2020-10-11 12:23:23', ts timestamp default '2020-10-13 12:23:23');
show create table t1;
insert into t1 values();
select * from t1;
alter table t1 add column da1 date default '2020-03-27 20:20:20 123456';
show create table t1;
select * from t1;
alter table t1 change ts da2 date default '2020-10-10 20:20:20';
show create table t1;
select * from t1;
# TestIssue39080
drop table if exists t1, t2;
CREATE TABLE t1(id INTEGER PRIMARY KEY, authorId INTEGER AUTO_INCREMENT UNIQUE);
show create table t1;
CREATE TABLE `t2`( `id` INTEGER PRIMARY KEY, `authorId` int(11) AUTO_INCREMENT, UNIQUE KEY `authorIdx` (`authorId`));
show create table t2;
# TestIssue52972
# Test creating columns with error defaults when sql_mode is empty.
set @@sql_mode='';
drop table if exists t1;
--error 1067
create table t1(b tinyint default '11111111');
--error 1067
create table t1(b tinyint default '11abc');
--error 1067
create table t1(b datetime default '11abc');
--error 1067
create table t1(b date default '2024-10');
create table t1(a tinyint, b date default '2024-10-24 12:20');
--error 1067
alter table t1 add column(c tinyint default '11111111');
--error 1067
alter table t1 add column(c tinyint default '11abc');
--error 1067
alter table t1 add column(c datetime default '11abc');
--error 1067
alter table t1 add column d date default '2024-10';
# TestIssue53779
drop table if exists t;
create table t(a decimal(0,0), b decimal(0));
show create table t;