2020-05-25 11:11:51 +00:00
|
|
|
DROP TABLE IF EXISTS data_null;
|
2020-05-25 18:58:30 +00:00
|
|
|
DROP TABLE IF EXISTS set_null;
|
2020-05-25 11:11:51 +00:00
|
|
|
|
2020-06-14 16:17:22 +00:00
|
|
|
SET data_type_default_nullable='false';
|
|
|
|
|
2020-05-25 11:11:51 +00:00
|
|
|
CREATE TABLE data_null (
|
|
|
|
a INT NULL,
|
|
|
|
b INT NOT NULL,
|
2020-05-25 18:58:30 +00:00
|
|
|
c Nullable(INT),
|
|
|
|
d INT
|
|
|
|
) engine=Memory();
|
2020-05-25 11:11:51 +00:00
|
|
|
|
|
|
|
|
2020-06-14 16:17:22 +00:00
|
|
|
INSERT INTO data_null VALUES (NULL, 2, NULL, 4);
|
2020-05-25 18:58:30 +00:00
|
|
|
|
|
|
|
SELECT toTypeName(a), toTypeName(b), toTypeName(c), toTypeName(d) FROM data_null;
|
|
|
|
|
2020-06-14 16:17:22 +00:00
|
|
|
SHOW CREATE TABLE data_null;
|
2020-05-25 18:58:30 +00:00
|
|
|
|
2020-06-14 16:17:22 +00:00
|
|
|
CREATE TABLE data_null_error (
|
2020-05-25 18:58:30 +00:00
|
|
|
a Nullable(INT) NULL,
|
|
|
|
b INT NOT NULL,
|
|
|
|
c Nullable(INT)
|
|
|
|
) engine=Memory(); --{serverError 377}
|
|
|
|
|
|
|
|
|
2020-06-14 16:17:22 +00:00
|
|
|
CREATE TABLE data_null_error (
|
2020-05-25 18:58:30 +00:00
|
|
|
a INT NULL,
|
|
|
|
b Nullable(INT) NOT NULL,
|
|
|
|
c Nullable(INT)
|
|
|
|
) engine=Memory(); --{serverError 377}
|
|
|
|
|
|
|
|
SET data_type_default_nullable='true';
|
|
|
|
|
|
|
|
CREATE TABLE set_null (
|
|
|
|
a INT NULL,
|
|
|
|
b INT NOT NULL,
|
|
|
|
c Nullable(INT),
|
|
|
|
d INT
|
|
|
|
) engine=Memory();
|
|
|
|
|
|
|
|
|
2020-06-14 16:17:22 +00:00
|
|
|
INSERT INTO set_null VALUES (NULL, 2, NULL, NULL);
|
2020-05-25 18:58:30 +00:00
|
|
|
|
|
|
|
SELECT toTypeName(a), toTypeName(b), toTypeName(c), toTypeName(d) FROM set_null;
|
2020-06-14 16:17:22 +00:00
|
|
|
|
|
|
|
SHOW CREATE TABLE set_null;
|
|
|
|
|
|
|
|
DROP TABLE data_null;
|
|
|
|
DROP TABLE set_null;
|