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;
|
2021-04-16 10:15:35 +00:00
|
|
|
DROP TABLE IF EXISTS cannot_be_nullable;
|
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;
|
2021-04-16 10:15:35 +00:00
|
|
|
DETACH TABLE set_null;
|
|
|
|
ATTACH TABLE set_null;
|
|
|
|
SHOW CREATE TABLE set_null;
|
|
|
|
|
|
|
|
CREATE TABLE cannot_be_nullable (n Int8, a Array(UInt8)) ENGINE=Memory; -- { serverError 43 }
|
|
|
|
CREATE TABLE cannot_be_nullable (n Int8, a Array(UInt8) NOT NULL) ENGINE=Memory;
|
|
|
|
SHOW CREATE TABLE cannot_be_nullable;
|
|
|
|
DETACH TABLE cannot_be_nullable;
|
|
|
|
ATTACH TABLE cannot_be_nullable;
|
|
|
|
SHOW CREATE TABLE cannot_be_nullable;
|
2020-06-14 16:17:22 +00:00
|
|
|
|
|
|
|
DROP TABLE data_null;
|
|
|
|
DROP TABLE set_null;
|
2021-04-16 10:15:35 +00:00
|
|
|
DROP TABLE cannot_be_nullable;
|