Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
90f09ba8
Commit
90f09ba8
authored
Mar 05, 2019
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-18819: Add a test case
parent
730ed990
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
184 additions
and
0 deletions
+184
-0
mysql-test/suite/innodb/r/innodb-alter-nullable.result
mysql-test/suite/innodb/r/innodb-alter-nullable.result
+116
-0
mysql-test/suite/innodb/t/innodb-alter-nullable.test
mysql-test/suite/innodb/t/innodb-alter-nullable.test
+68
-0
No files found.
mysql-test/suite/innodb/r/innodb-alter-nullable.result
View file @
90f09ba8
...
...
@@ -87,3 +87,119 @@ c
0
1
DROP TABLE t1;
CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB;
CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB;
CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB;
INSERT INTO t1 SET c=NULL;
INSERT INTO t2 SET c=NULL;
INSERT INTO t3 SET c=NULL;
SET @old_sql_mode = @@sql_mode;
SET sql_mode = '';
ALTER TABLE t1 MODIFY c INT NOT NULL;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
ALTER TABLE t2 MODIFY c INT NOT NULL;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
ALTER TABLE t3 MODIFY c INT NOT NULL;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
SET sql_mode = @old_sql_mode;
SELECT * FROM t1;
c g
0 0
SELECT * FROM t2;
c v
0 0
SELECT * FROM t3;
c v
0 0
SELECT v FROM t3 FORCE INDEX(v);
v
0
CHECK TABLE t1,t2,t3;
Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check status OK
test.t3 check status OK
DROP TABLE t1,t2,t3;
CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB;
CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB;
CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB;
INSERT INTO t1 SET c=NULL;
INSERT INTO t2 SET c=NULL;
INSERT INTO t3 SET c=NULL;
ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
ALTER IGNORE TABLE t3 MODIFY c INT NOT NULL;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
SELECT * FROM t1;
c g
0 0
SELECT * FROM t2;
c v
0 0
SELECT * FROM t3;
c v
0 0
SELECT v FROM t3 FORCE INDEX(v);
v
0
CHECK TABLE t1,t2,t3;
Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check status OK
test.t3 check status OK
DROP TABLE t1,t2,t3;
CREATE TABLE t1(c INT, g INT AS (c) PERSISTENT) ENGINE=InnoDB;
CREATE TABLE t2(c INT, v INT AS (c) VIRTUAL) ENGINE=InnoDB;
CREATE TABLE t3(c INT, v INT AS (c) VIRTUAL, INDEX(v)) ENGINE=InnoDB;
INSERT INTO t1 SET c=NULL;
INSERT INTO t2 SET c=NULL;
INSERT INTO t3 SET c=NULL;
ALTER TABLE t1 MODIFY c INT NOT NULL;
ERROR 22004: Invalid use of NULL value
ALTER TABLE t2 MODIFY c INT NOT NULL;
ERROR 22004: Invalid use of NULL value
ALTER TABLE t3 MODIFY c INT NOT NULL;
ERROR 01000: Data truncated for column 'c' at row 1
UPDATE t1 SET c=0;
UPDATE t2 SET c=0;
UPDATE t3 SET c=0;
ALTER TABLE t1 MODIFY c INT NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t2 MODIFY c INT NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
# MDEV-18819 FIXME: This should not require ALGORITHM=COPY.
ALTER TABLE t3 MODIFY c INT NOT NULL;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
SELECT * FROM t1;
c g
0 0
SELECT * FROM t2;
c v
0 0
SELECT * FROM t3;
c v
0 0
DROP TABLE t1,t2,t3;
mysql-test/suite/innodb/t/innodb-alter-nullable.test
View file @
90f09ba8
...
...
@@ -89,6 +89,74 @@ ALTER IGNORE TABLE t1 ADD PRIMARY KEY(c);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
c
INT
,
g
INT
AS
(
c
)
PERSISTENT
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t2
(
c
INT
,
v
INT
AS
(
c
)
VIRTUAL
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t3
(
c
INT
,
v
INT
AS
(
c
)
VIRTUAL
,
INDEX
(
v
))
ENGINE
=
InnoDB
;
INSERT
INTO
t1
SET
c
=
NULL
;
INSERT
INTO
t2
SET
c
=
NULL
;
INSERT
INTO
t3
SET
c
=
NULL
;
SET
@
old_sql_mode
=
@@
sql_mode
;
# Allow lossy conversions of data
SET
sql_mode
=
''
;
--
enable_info
ALTER
TABLE
t1
MODIFY
c
INT
NOT
NULL
;
ALTER
TABLE
t2
MODIFY
c
INT
NOT
NULL
;
ALTER
TABLE
t3
MODIFY
c
INT
NOT
NULL
;
--
disable_info
SET
sql_mode
=
@
old_sql_mode
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
SELECT
*
FROM
t3
;
SELECT
v
FROM
t3
FORCE
INDEX
(
v
);
CHECK
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
CREATE
TABLE
t1
(
c
INT
,
g
INT
AS
(
c
)
PERSISTENT
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t2
(
c
INT
,
v
INT
AS
(
c
)
VIRTUAL
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t3
(
c
INT
,
v
INT
AS
(
c
)
VIRTUAL
,
INDEX
(
v
))
ENGINE
=
InnoDB
;
INSERT
INTO
t1
SET
c
=
NULL
;
INSERT
INTO
t2
SET
c
=
NULL
;
INSERT
INTO
t3
SET
c
=
NULL
;
--
enable_info
ALTER
IGNORE
TABLE
t1
MODIFY
c
INT
NOT
NULL
;
ALTER
IGNORE
TABLE
t2
MODIFY
c
INT
NOT
NULL
;
ALTER
IGNORE
TABLE
t3
MODIFY
c
INT
NOT
NULL
;
--
disable_info
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
SELECT
*
FROM
t3
;
SELECT
v
FROM
t3
FORCE
INDEX
(
v
);
CHECK
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
CREATE
TABLE
t1
(
c
INT
,
g
INT
AS
(
c
)
PERSISTENT
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t2
(
c
INT
,
v
INT
AS
(
c
)
VIRTUAL
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t3
(
c
INT
,
v
INT
AS
(
c
)
VIRTUAL
,
INDEX
(
v
))
ENGINE
=
InnoDB
;
INSERT
INTO
t1
SET
c
=
NULL
;
INSERT
INTO
t2
SET
c
=
NULL
;
INSERT
INTO
t3
SET
c
=
NULL
;
--
enable_info
--
error
ER_INVALID_USE_OF_NULL
ALTER
TABLE
t1
MODIFY
c
INT
NOT
NULL
;
--
error
ER_INVALID_USE_OF_NULL
ALTER
TABLE
t2
MODIFY
c
INT
NOT
NULL
;
--
error
WARN_DATA_TRUNCATED
ALTER
TABLE
t3
MODIFY
c
INT
NOT
NULL
;
--
disable_info
UPDATE
t1
SET
c
=
0
;
UPDATE
t2
SET
c
=
0
;
UPDATE
t3
SET
c
=
0
;
--
enable_info
ALTER
TABLE
t1
MODIFY
c
INT
NOT
NULL
;
ALTER
TABLE
t2
MODIFY
c
INT
NOT
NULL
;
--
echo
# MDEV-18819 FIXME: This should not require ALGORITHM=COPY.
ALTER
TABLE
t3
MODIFY
c
INT
NOT
NULL
;
--
disable_info
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
SELECT
*
FROM
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--
source
include
/
wait_until_count_sessions
.
inc
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment