Skip to content

Commit 6192717

Browse files
authored
*: add expression default values feature relevant tests and fix the "extra" field issue. (#51482)
close #51462, close #51481
1 parent 6000c2a commit 6192717

File tree

4 files changed

+397
-4
lines changed

4 files changed

+397
-4
lines changed

pkg/ddl/db_integration_test.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,13 +1632,14 @@ func TestDefaultColumnWithDateFormat(t *testing.T) {
16321632

16331633
// insert records
16341634
nowTime := time.Now()
1635-
for i := 0; i < 5; i++ {
1636-
tk.MustExec(fmt.Sprintf("insert into t%d(c) values (1),(2)", i))
1635+
for i := 0; i < 6; i++ {
1636+
tk.MustExec(fmt.Sprintf("insert into t%d(c) values (1)", i))
1637+
tk.MustExec(fmt.Sprintf("insert into t%d(c) values (1),(default)", i))
16371638
}
16381639
tk.MustGetErrCode("insert into t6(c) values (1)", errno.ErrTruncatedWrongValue)
16391640
tk.MustGetErrCode("insert into t7(c) values (1)", errno.ErrTruncatedWrongValue)
16401641

1641-
for i := 0; i < 4; i++ {
1642+
for i := 0; i < 6; i++ {
16421643
rows := tk.MustQuery(fmt.Sprintf("SELECT c1 from t%d order by c", i)).Rows()
16431644
for _, row := range rows {
16441645
d, ok := row[0].(string)
@@ -1653,10 +1654,12 @@ func TestDefaultColumnWithDateFormat(t *testing.T) {
16531654
require.Equal(t, nowTime.Add(1*time.Second).Format("2006-01-02 15.04.05"), d,
16541655
fmt.Sprintf("now time:%v, get time:%v", nowTime.Format("2006-01-02 15.04.05"), d))
16551656
}
1656-
case 3, 4, 5:
1657+
case 3:
16571658
if nowTime.Format("2006-01-02 15:04:05") != d {
16581659
require.Equal(t, nowTime.Add(1*time.Second).Format("2006-01-02 15:04:05"), d)
16591660
}
1661+
case 4, 5:
1662+
require.Equal(t, nowTime.Format("2006-01-02"), d)
16601663
}
16611664
}
16621665
}
@@ -1696,6 +1699,10 @@ func TestDefaultColumnWithDateFormat(t *testing.T) {
16961699
" `c` int(10) DEFAULT NULL,\n" +
16971700
" `c1` datetime DEFAULT date_format(now(), _utf8mb4'%Y-%m-%d')\n" +
16981701
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"))
1702+
tk.MustQuery("SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t1' AND COLUMN_NAME='c1';").Check(testkit.Rows(
1703+
"date_format(now(), _utf8mb4'%Y-%m-%d') DEFAULT_GENERATED"))
1704+
tk.MustQuery("show columns from test.t1 where field='c1';").Check(testkit.Rows(
1705+
"c1 datetime YES date_format(now(), _utf8mb4'%Y-%m-%d') DEFAULT_GENERATED"))
16991706
}
17001707

17011708
func TestDefaultColumnWithReplace(t *testing.T) {
@@ -1719,6 +1726,7 @@ func TestDefaultColumnWithReplace(t *testing.T) {
17191726

17201727
// insert records
17211728
tk.MustExec("insert into t(c) values (1),(2),(3)")
1729+
tk.MustExec("insert into t values (4, default)")
17221730
// Different UUID values will result in different error code.
17231731
_, err := tk.Exec("insert into t1(c) values (1)")
17241732
originErr := errors.Cause(err)
@@ -1772,6 +1780,8 @@ func TestDefaultColumnWithReplace(t *testing.T) {
17721780
" `c` int(10) DEFAULT NULL,\n" +
17731781
" `c1` varchar(32) DEFAULT replace(upper(uuid()), _utf8mb4'-', _utf8mb4'')\n" +
17741782
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"))
1783+
tk.MustQuery("SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t1' AND COLUMN_NAME='c1';").Check(testkit.Rows(
1784+
"replace(upper(uuid()), _utf8mb4'-', _utf8mb4'') DEFAULT_GENERATED"))
17751785
}
17761786

17771787
func TestDefaultColumnWithStrToDate(t *testing.T) {
@@ -1801,13 +1811,17 @@ func TestDefaultColumnWithStrToDate(t *testing.T) {
18011811
// insert records
18021812
tk.MustExec("insert into t0(c) values (1),(2),(3)")
18031813
tk.MustExec("insert into t1(c) values (1),(2),(3)")
1814+
tk.MustExec("insert into t0 values (4, default, default)")
1815+
tk.MustExec("insert into t1 values (4, default, default)")
18041816
tk.MustGetErrCode("insert into t3(c) values (1)", errno.ErrTruncatedWrongValue)
18051817
tk.MustGetErrCode("insert into t4(c) values (1)", errno.ErrTruncatedWrongValue)
18061818
// MySQL will return an error. Related issue: https://github.com/pingcap/tidb/issues/51275.
18071819
tk.MustExec("insert into t5(c) values (1)")
18081820
tk.MustExec("set @@sql_mode=''")
18091821
tk.MustExec("insert into t2(c) values (1),(2),(3)")
1822+
tk.MustExec("insert into t2 values (4, default, default)")
18101823
tk.MustExec(fmt.Sprintf(`set session sql_mode="%s"`, sqlMode))
1824+
tk.MustGetErrCode("insert into t2(c) values (5)", errno.ErrTruncatedWrongValue)
18111825

18121826
for i := 0; i < 3; i++ {
18131827
rows := tk.MustQuery(fmt.Sprintf("SELECT c1, c2 from t%d", i)).Rows()
@@ -1866,6 +1880,8 @@ func TestDefaultColumnWithStrToDate(t *testing.T) {
18661880
" `c1` varchar(32) DEFAULT str_to_date(_utf8mb4'1980-01-01', _utf8mb4'%Y-%m-%d'),\n" +
18671881
" `c2` int(11) DEFAULT str_to_date(_utf8mb4'9999-01-01', _utf8mb4'%Y-%m-%d')\n" +
18681882
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"))
1883+
tk.MustQuery("SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t1' AND COLUMN_NAME='c1';").Check(testkit.Rows(
1884+
"str_to_date(_utf8mb4'1980-01-01', _utf8mb4'%Y-%m-%d') DEFAULT_GENERATED"))
18691885
}
18701886

18711887
func TestDefaultColumnWithUpper(t *testing.T) {
@@ -1890,6 +1906,7 @@ func TestDefaultColumnWithUpper(t *testing.T) {
18901906
tk.MustGetErrCode("insert into t1(c) values (1)", errno.ErrTruncatedWrongValue)
18911907
tk.Session().GetSessionVars().User = &auth.UserIdentity{Username: "xyz", Hostname: "localhost"}
18921908
tk.MustExec("insert into t(c) values (4),(5),(6)")
1909+
tk.MustExec("insert into t values (7, default)")
18931910

18941911
rows := tk.MustQuery("SELECT c1 from t order by c").Rows()
18951912
for i, row := range rows {
@@ -1924,6 +1941,8 @@ func TestDefaultColumnWithUpper(t *testing.T) {
19241941
" `c` int(10) DEFAULT NULL,\n" +
19251942
" `c1` varchar(32) DEFAULT upper(substring_index(user(), _utf8mb4'@', 1))\n" +
19261943
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"))
1944+
tk.MustQuery("SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t1' AND COLUMN_NAME='c1';").Check(testkit.Rows(
1945+
"upper(substring_index(user(), _utf8mb4'@', 1)) DEFAULT_GENERATED"))
19271946
}
19281947

19291948
func TestChangingDBCharset(t *testing.T) {

pkg/table/column.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ func NewColDesc(col *Column) *ColDesc {
437437
} else {
438438
extra = "VIRTUAL GENERATED"
439439
}
440+
} else if col.DefaultIsExpr {
441+
extra = "DEFAULT_GENERATED"
440442
}
441443

442444
desc := &ColDesc{
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
drop table if exists t0, t1, t2, t3;
2+
create table t0 (c int(10), c1 BLOB default (date_format(now(),'%Y-%m-%d')));
3+
create table t1 (c int(10), c1 JSON default (date_format(now(),'%Y-%m-%d')));
4+
create table t2 (c int(10), c1 ENUM('y','n') default (date_format(now(),'%Y-%m-%d')));
5+
create table t3 (c int(10), c1 SET('y','n') default (date_format(now(),'%Y-%m-%d')));
6+
INSERT INTO t0 values ();
7+
INSERT INTO t0 values (1, DEFAULT);
8+
select count(1) from t0 where c1 = date_format(now(), '%Y-%m-%d');
9+
count(1)
10+
2
11+
INSERT INTO t1 values ();
12+
Error 3140 (22032): Invalid JSON text: The document root must not be followed by other values.
13+
INSERT INTO t1 values (1, DEFAULT);
14+
Error 3140 (22032): Invalid JSON text: The document root must not be followed by other values.
15+
SELECT * from t1;
16+
c c1
17+
INSERT INTO t2 values ();
18+
Error 1265 (01000): Data truncated for column '%s' at row %d
19+
INSERT INTO t2 values (1, DEFAULT);
20+
Error 1265 (01000): Data truncated for column '%s' at row %d
21+
SELECT * from t2;
22+
c c1
23+
INSERT INTO t3 values ();
24+
Error 1265 (01000): Data truncated for column '%s' at row %d
25+
INSERT INTO t3 values (1, DEFAULT);
26+
Error 1265 (01000): Data truncated for column '%s' at row %d
27+
SELECT * from t3;
28+
c c1
29+
show create table t0;
30+
Table Create Table
31+
t0 CREATE TABLE `t0` (
32+
`c` int(10) DEFAULT NULL,
33+
`c1` blob DEFAULT date_format(now(), _utf8mb4'%Y-%m-%d')
34+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
35+
show create table t1;
36+
Table Create Table
37+
t1 CREATE TABLE `t1` (
38+
`c` int(10) DEFAULT NULL,
39+
`c1` json DEFAULT date_format(now(), _utf8mb4'%Y-%m-%d')
40+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
41+
show create table t2;
42+
Table Create Table
43+
t2 CREATE TABLE `t2` (
44+
`c` int(10) DEFAULT NULL,
45+
`c1` enum('y','n') DEFAULT date_format(now(), _utf8mb4'%Y-%m-%d')
46+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
47+
show create table t3;
48+
Table Create Table
49+
t3 CREATE TABLE `t3` (
50+
`c` int(10) DEFAULT NULL,
51+
`c1` set('y','n') DEFAULT date_format(now(), _utf8mb4'%Y-%m-%d')
52+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
53+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t0' AND COLUMN_NAME='c1';
54+
column_default extra
55+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t1' AND COLUMN_NAME='c1';
56+
column_default extra
57+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t2' AND COLUMN_NAME='c1';
58+
column_default extra
59+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t3' AND COLUMN_NAME='c1';
60+
column_default extra
61+
drop table t0, t1, t2, t3;
62+
create table t0 (c int(10), c1 BLOB default (REPLACE(UPPER(UUID()), '-', '')));
63+
create table t1 (c int(10), c1 JSON default (REPLACE(UPPER(UUID()), '-', '')));
64+
create table t2 (c int(10), c1 ENUM('y','n') default (REPLACE(UPPER(UUID()), '-', '')));
65+
create table t3 (c int(10), c1 SET('y','n') default (REPLACE(UPPER(UUID()), '-', '')));
66+
INSERT INTO t0 values ();
67+
INSERT INTO t0 values (1, DEFAULT);
68+
SELECT count(1) FROM t0 WHERE c1 REGEXP '^[A-Z0-9]+$';
69+
count(1)
70+
2
71+
INSERT INTO t1 values ();
72+
Error 3140 (22032): Invalid JSON text: The document root must not be followed by other values.
73+
INSERT INTO t1 values (1, DEFAULT);
74+
Error 3140 (22032): Invalid JSON text: The document root must not be followed by other values.
75+
SELECT * from t1;
76+
c c1
77+
INSERT INTO t2 values ();
78+
Error 1265 (01000): Data truncated for column '%s' at row %d
79+
INSERT INTO t2 values (1, DEFAULT);
80+
Error 1265 (01000): Data truncated for column '%s' at row %d
81+
SELECT * from t2;
82+
c c1
83+
INSERT INTO t3 values ();
84+
Error 1265 (01000): Data truncated for column '%s' at row %d
85+
INSERT INTO t3 values (1, DEFAULT);
86+
Error 1265 (01000): Data truncated for column '%s' at row %d
87+
SELECT * from t3;
88+
c c1
89+
show create table t0;
90+
Table Create Table
91+
t0 CREATE TABLE `t0` (
92+
`c` int(10) DEFAULT NULL,
93+
`c1` blob DEFAULT replace(upper(uuid()), _utf8mb4'-', _utf8mb4'')
94+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
95+
show create table t1;
96+
Table Create Table
97+
t1 CREATE TABLE `t1` (
98+
`c` int(10) DEFAULT NULL,
99+
`c1` json DEFAULT replace(upper(uuid()), _utf8mb4'-', _utf8mb4'')
100+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
101+
show create table t2;
102+
Table Create Table
103+
t2 CREATE TABLE `t2` (
104+
`c` int(10) DEFAULT NULL,
105+
`c1` enum('y','n') DEFAULT replace(upper(uuid()), _utf8mb4'-', _utf8mb4'')
106+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
107+
show create table t3;
108+
Table Create Table
109+
t3 CREATE TABLE `t3` (
110+
`c` int(10) DEFAULT NULL,
111+
`c1` set('y','n') DEFAULT replace(upper(uuid()), _utf8mb4'-', _utf8mb4'')
112+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
113+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t0' AND COLUMN_NAME='c1';
114+
column_default extra
115+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t1' AND COLUMN_NAME='c1';
116+
column_default extra
117+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t2' AND COLUMN_NAME='c1';
118+
column_default extra
119+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t3' AND COLUMN_NAME='c1';
120+
column_default extra
121+
drop table t0, t1, t2, t3;
122+
create table t0 (c int(10), c1 BLOB default (str_to_date('1980-01-01','%Y-%m-%d')));
123+
create table t1 (c int(10), c1 JSON default (str_to_date('1980-01-01','%Y-%m-%d')));
124+
create table t2 (c int(10), c1 ENUM('y','n') default (str_to_date('1980-01-01','%Y-%m-%d')));
125+
create table t3 (c int(10), c1 SET('y','n') default (str_to_date('1980-01-01','%Y-%m-%d')));
126+
INSERT INTO t0 values ();
127+
INSERT INTO t0 values (1, DEFAULT);
128+
SELECT * from t0;
129+
c c1
130+
NULL 1980-01-01
131+
1 1980-01-01
132+
INSERT INTO t1 values ();
133+
INSERT INTO t1 values (1, DEFAULT);
134+
SELECT * from t1;
135+
c c1
136+
NULL "1980-01-01"
137+
1 "1980-01-01"
138+
INSERT INTO t2 values ();
139+
Error 1265 (01000): Data truncated for column '%s' at row %d
140+
INSERT INTO t2 values (1, DEFAULT);
141+
Error 1265 (01000): Data truncated for column '%s' at row %d
142+
SELECT * from t2;
143+
c c1
144+
INSERT INTO t3 values ();
145+
Error 1265 (01000): Data truncated for column '%s' at row %d
146+
INSERT INTO t3 values (1, DEFAULT);
147+
Error 1265 (01000): Data truncated for column '%s' at row %d
148+
SELECT * from t3;
149+
c c1
150+
show create table t0;
151+
Table Create Table
152+
t0 CREATE TABLE `t0` (
153+
`c` int(10) DEFAULT NULL,
154+
`c1` blob DEFAULT str_to_date(_utf8mb4'1980-01-01', _utf8mb4'%Y-%m-%d')
155+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
156+
show create table t1;
157+
Table Create Table
158+
t1 CREATE TABLE `t1` (
159+
`c` int(10) DEFAULT NULL,
160+
`c1` json DEFAULT str_to_date(_utf8mb4'1980-01-01', _utf8mb4'%Y-%m-%d')
161+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
162+
show create table t2;
163+
Table Create Table
164+
t2 CREATE TABLE `t2` (
165+
`c` int(10) DEFAULT NULL,
166+
`c1` enum('y','n') DEFAULT str_to_date(_utf8mb4'1980-01-01', _utf8mb4'%Y-%m-%d')
167+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
168+
show create table t3;
169+
Table Create Table
170+
t3 CREATE TABLE `t3` (
171+
`c` int(10) DEFAULT NULL,
172+
`c1` set('y','n') DEFAULT str_to_date(_utf8mb4'1980-01-01', _utf8mb4'%Y-%m-%d')
173+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
174+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t0' AND COLUMN_NAME='c1';
175+
column_default extra
176+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t1' AND COLUMN_NAME='c1';
177+
column_default extra
178+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t2' AND COLUMN_NAME='c1';
179+
column_default extra
180+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t3' AND COLUMN_NAME='c1';
181+
column_default extra
182+
drop table t0, t1, t2, t3;
183+
create table t0 (c int(10), c1 BLOB default (upper(substring_index(user(),'@',1))));
184+
create table t1 (c int(10), c1 JSON default (upper(substring_index(user(),'@',1))));
185+
create table t2 (c int(10), c1 ENUM('y','n') default (upper(substring_index(user(),'@',1))));
186+
create table t3 (c int(10), c1 SET('y','n') default (upper(substring_index(user(),'@',1))));
187+
INSERT INTO t0 values ();
188+
INSERT INTO t0 values (1, DEFAULT);
189+
SELECT * from t0;
190+
c c1
191+
NULL ROOT
192+
1 ROOT
193+
INSERT INTO t1 values ();
194+
Error 3140 (22032): Invalid JSON text: The document root must not be followed by other values.
195+
INSERT INTO t1 values (1, DEFAULT);
196+
Error 3140 (22032): Invalid JSON text: The document root must not be followed by other values.
197+
SELECT * from t1;
198+
c c1
199+
INSERT INTO t2 values ();
200+
Error 1265 (01000): Data truncated for column '%s' at row %d
201+
INSERT INTO t2 values (1, DEFAULT);
202+
Error 1265 (01000): Data truncated for column '%s' at row %d
203+
SELECT * from t2;
204+
c c1
205+
INSERT INTO t3 values ();
206+
Error 1265 (01000): Data truncated for column '%s' at row %d
207+
INSERT INTO t3 values (1, DEFAULT);
208+
Error 1265 (01000): Data truncated for column '%s' at row %d
209+
SELECT * from t3;
210+
c c1
211+
show create table t0;
212+
Table Create Table
213+
t0 CREATE TABLE `t0` (
214+
`c` int(10) DEFAULT NULL,
215+
`c1` blob DEFAULT upper(substring_index(user(), _utf8mb4'@', 1))
216+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
217+
show create table t1;
218+
Table Create Table
219+
t1 CREATE TABLE `t1` (
220+
`c` int(10) DEFAULT NULL,
221+
`c1` json DEFAULT upper(substring_index(user(), _utf8mb4'@', 1))
222+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
223+
show create table t2;
224+
Table Create Table
225+
t2 CREATE TABLE `t2` (
226+
`c` int(10) DEFAULT NULL,
227+
`c1` enum('y','n') DEFAULT upper(substring_index(user(), _utf8mb4'@', 1))
228+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
229+
show create table t3;
230+
Table Create Table
231+
t3 CREATE TABLE `t3` (
232+
`c` int(10) DEFAULT NULL,
233+
`c1` set('y','n') DEFAULT upper(substring_index(user(), _utf8mb4'@', 1))
234+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
235+
drop table t0, t1, t2, t3;
236+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t0' AND COLUMN_NAME='c1';
237+
column_default extra
238+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t1' AND COLUMN_NAME='c1';
239+
column_default extra
240+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t2' AND COLUMN_NAME='c1';
241+
column_default extra
242+
SELECT column_default, extra FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND TABLE_NAME='t3' AND COLUMN_NAME='c1';
243+
column_default extra

0 commit comments

Comments
 (0)