-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tianmu): support add integer/decimal column DDL with default valu…
…e. (#1187) [summary] check the default value of field,please see tianmu_attr.cpp for details: 1. if field is integer type but not real type; 2. if field is integer type and also real type; 3. if field is not integer type;
- Loading branch information
lujiashun
committed
Jan 12, 2023
1 parent
3fa2aab
commit 62cd214
Showing
10 changed files
with
244 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
DROP DATABASE IF EXISTS issuse1187_test; | ||
CREATE DATABASE issuse1187_test; | ||
USE issuse1187_test; | ||
create table t1(id int,name varchar(5)) ; | ||
insert into t1 values(1,'AAA'),(2,'BBB'); | ||
alter table t1 add column age int null; | ||
select * from t1; | ||
id name age | ||
1 AAA NULL | ||
2 BBB NULL | ||
create table t2(id int,name varchar(5)) ; | ||
insert into t2 values(1,'AAA'),(2,'BBB'); | ||
alter table t2 add column age int not null; | ||
select * from t2; | ||
id name age | ||
1 AAA 0 | ||
2 BBB 0 | ||
create table t3(id int,name varchar(5)) ; | ||
insert into t3 values(1,'AAA'),(2,'BBB'); | ||
alter table t3 add column age int not null default 66; | ||
select * from t3; | ||
id name age | ||
1 AAA 66 | ||
2 BBB 66 | ||
create table t4(id int,name varchar(5)) ; | ||
insert into t4 values(1,'AAA'),(2,'BBB'); | ||
alter table t4 add column age DECIMAL(17,9); | ||
select * from t4; | ||
id name age | ||
1 AAA NULL | ||
2 BBB NULL | ||
create table t5(id int,name varchar(5)) ; | ||
insert into t5 values(1,'AAA'),(2,'BBB'); | ||
alter table t5 add column age DECIMAL(17,9) not null; | ||
select * from t5; | ||
id name age | ||
1 AAA 0.000000000 | ||
2 BBB 0.000000000 | ||
create table t6(id int,name varchar(5)) ; | ||
insert into t6 values(1,'AAA'),(2,'BBB'); | ||
alter table t6 add column age DECIMAL(17,9) not null default '800.0024'; | ||
select * from t6; | ||
id name age | ||
1 AAA 800.002400000 | ||
2 BBB 800.002400000 | ||
DROP DATABASE issuse1187_test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--source include/have_tianmu.inc | ||
|
||
--disable_warnings | ||
DROP DATABASE IF EXISTS issuse1187_test; | ||
--enable_warnings | ||
|
||
CREATE DATABASE issuse1187_test; | ||
USE issuse1187_test; | ||
|
||
create table t1(id int,name varchar(5)) ; | ||
insert into t1 values(1,'AAA'),(2,'BBB'); | ||
alter table t1 add column age int null; | ||
select * from t1; | ||
|
||
create table t2(id int,name varchar(5)) ; | ||
insert into t2 values(1,'AAA'),(2,'BBB'); | ||
alter table t2 add column age int not null; | ||
select * from t2; | ||
|
||
create table t3(id int,name varchar(5)) ; | ||
insert into t3 values(1,'AAA'),(2,'BBB'); | ||
alter table t3 add column age int not null default 66; | ||
select * from t3; | ||
|
||
create table t4(id int,name varchar(5)) ; | ||
insert into t4 values(1,'AAA'),(2,'BBB'); | ||
alter table t4 add column age DECIMAL(17,9); | ||
select * from t4; | ||
|
||
create table t5(id int,name varchar(5)) ; | ||
insert into t5 values(1,'AAA'),(2,'BBB'); | ||
alter table t5 add column age DECIMAL(17,9) not null; | ||
select * from t5; | ||
|
||
create table t6(id int,name varchar(5)) ; | ||
insert into t6 values(1,'AAA'),(2,'BBB'); | ||
alter table t6 add column age DECIMAL(17,9) not null default '800.0024'; | ||
select * from t6; | ||
|
||
DROP DATABASE issuse1187_test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.