v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t2`.`d` AS `d`,`test`.`t2`.`e` AS `e`,`test`.`t2`.`f` AS `f` from `t2` latin1 latin1_swedish_ci
Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
SELECT * FROM v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a)));
INSERT INTO t_gen(a) VALUES(4);
SELECT * FROM t_gen;
a b
4 2
SHOW CREATE TABLE t_gen;
Table Create Table
t_gen CREATE TABLE `t_gen` (
`a` int(11) DEFAULT NULL,
`b` double GENERATED ALWAYS AS (sqrt(`a`)) VIRTUAL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1
ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c));
SELECT * FROM t_gen;
c b
4 2
SHOW CREATE TABLE t_gen;
Table Create Table
t_gen CREATE TABLE `t_gen` (
`c` int(11) DEFAULT NULL,
`b` double GENERATED ALWAYS AS (sqrt(`c`)) VIRTUAL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1
ALTER TABLE t_gen CHANGE COLUMN c x INT;
show create table t_gen;
Table Create Table
t_gen CREATE TABLE `t_gen` (
`x` int(11) DEFAULT NULL,
`b` double GENERATED ALWAYS AS (sqrt(`x`)) VIRTUAL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1
ALTER TABLE t_gen RENAME COLUMN x TO a;
DROP TABLE t_gen;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` varchar(30) DEFAULT NULL,
`b` int(11) DEFAULT 5,
KEY `b` (`b`)
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1
ALTER TABLE t1 RENAME COLUMN b z;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'z' at line 1
ALTER TABLE t1 RENAME COLUMN FROM b TO z;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM b TO z' at line 1
ALTER TABLE t1 RENAME COLUMN b TO 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1' at line 1
ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e;
ERROR 42S22: Unknown column 'c' in 't1'
ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z;
ERROR 42S21: Duplicate column name 'z'
ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z;
ERROR 42S22: Unknown column 'b' in 't1'
ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b;
ERROR 42S22: Unknown column 'b' in 't1'
ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3;
ERROR 42000: Can't DROP COLUMN `c3`; check that it exists
ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y;
ERROR 42S22: Unknown column 'z' in 't1'
ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y;
ERROR 42S22: Unknown column 'z' in 't1'
ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`;
ERROR 42000: Incorrect column name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn'
ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int;
ERROR 42000: Identifier name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' is too long
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` varchar(30) DEFAULT NULL,
`b` int(11) DEFAULT 5,
KEY `b` (`b`)
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1
SELECT * FROM t1;
d b
abcd 5
DROP VIEW v1;
DROP TABLE t3,t1,t2;
#
# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed
#
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam;
alter table t1 change x xx int, algorithm=inplace;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x));
alter table t1 change x xx int, algorithm=inplace;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
#
# End of 10.5 tests
#
set @@default_storage_engine= @save_default_engine;