mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge remote-tracking branch 'origin/10.4' into 10.5
This commit is contained in:
@@ -127,3 +127,51 @@ Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
InnoDB 0 transactions not purged
|
||||
DROP TABLE t1;
|
||||
SET @save_algo = @@GLOBAL.innodb_compression_algorithm;
|
||||
SET GLOBAL innodb_compression_algorithm=2;
|
||||
CREATE TABLE t1(a SERIAL) PAGE_COMPRESSED=1 ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
FLUSH TABLE t1 FOR EXPORT;
|
||||
# List before copying files
|
||||
db.opt
|
||||
t1.cfg
|
||||
t1.frm
|
||||
t1.ibd
|
||||
backup: t1
|
||||
UNLOCK TABLES;
|
||||
SET GLOBAL innodb_compression_algorithm=0;
|
||||
ALTER TABLE t1 FORCE;
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
db.opt
|
||||
t1.frm
|
||||
restore: t1 .ibd and .cfg files
|
||||
ALTER TABLE t1 IMPORT TABLESPACE;
|
||||
INSERT INTO t1 VALUES(2);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
SET GLOBAL innodb_compression_algorithm=3;
|
||||
FLUSH TABLE t1 FOR EXPORT;
|
||||
# List before copying files
|
||||
db.opt
|
||||
t1.cfg
|
||||
t1.frm
|
||||
t1.ibd
|
||||
backup: t1
|
||||
UNLOCK TABLES;
|
||||
SET GLOBAL innodb_compression_algorithm=0;
|
||||
ALTER TABLE t1 FORCE;
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
db.opt
|
||||
t1.frm
|
||||
restore: t1 .ibd and .cfg files
|
||||
ALTER TABLE t1 IMPORT TABLESPACE;
|
||||
INSERT INTO t1 VALUES(3);
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL innodb_compression_algorithm=@save_algo;
|
||||
|
||||
@@ -137,3 +137,64 @@ DELETE FROM t1;
|
||||
CHECK TABLE t1;
|
||||
--source include/wait_all_purged.inc
|
||||
DROP TABLE t1;
|
||||
|
||||
SET @save_algo = @@GLOBAL.innodb_compression_algorithm;
|
||||
SET GLOBAL innodb_compression_algorithm=2;
|
||||
CREATE TABLE t1(a SERIAL) PAGE_COMPRESSED=1 ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
FLUSH TABLE t1 FOR EXPORT;
|
||||
--echo # List before copying files
|
||||
let MYSQLD_DATADIR =`SELECT @@datadir`;
|
||||
|
||||
--list_files $MYSQLD_DATADIR/test
|
||||
perl;
|
||||
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
||||
ib_backup_tablespaces("test", "t1");
|
||||
EOF
|
||||
|
||||
UNLOCK TABLES;
|
||||
SET GLOBAL innodb_compression_algorithm=0;
|
||||
ALTER TABLE t1 FORCE;
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
|
||||
--list_files $MYSQLD_DATADIR/test
|
||||
perl;
|
||||
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
||||
ib_discard_tablespaces("test", "t1");
|
||||
ib_restore_tablespaces("test", "t1");
|
||||
EOF
|
||||
|
||||
ALTER TABLE t1 IMPORT TABLESPACE;
|
||||
INSERT INTO t1 VALUES(2);
|
||||
SELECT * FROM t1;
|
||||
|
||||
SET GLOBAL innodb_compression_algorithm=3;
|
||||
FLUSH TABLE t1 FOR EXPORT;
|
||||
--echo # List before copying files
|
||||
let MYSQLD_DATADIR =`SELECT @@datadir`;
|
||||
|
||||
--list_files $MYSQLD_DATADIR/test
|
||||
perl;
|
||||
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
||||
ib_backup_tablespaces("test", "t1");
|
||||
EOF
|
||||
|
||||
UNLOCK TABLES;
|
||||
SET GLOBAL innodb_compression_algorithm=0;
|
||||
ALTER TABLE t1 FORCE;
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
|
||||
--list_files $MYSQLD_DATADIR/test
|
||||
perl;
|
||||
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
||||
ib_discard_tablespaces("test", "t1");
|
||||
ib_restore_tablespaces("test", "t1");
|
||||
EOF
|
||||
|
||||
ALTER TABLE t1 IMPORT TABLESPACE;
|
||||
INSERT INTO t1 VALUES(3);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET GLOBAL innodb_compression_algorithm=@save_algo;
|
||||
|
||||
@@ -76,6 +76,7 @@ rmdir $targetdir;
|
||||
|
||||
perl;
|
||||
use lib "lib";
|
||||
use My::Handles { suppress_init_messages => 1 };
|
||||
use My::File::Path;
|
||||
my $install_db_dir = ($ENV{MTR_PARALLEL} == 1) ?
|
||||
"$ENV{'MYSQLTEST_VARDIR'}/install.db" :
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
##############################################################################
|
||||
#
|
||||
# List the test cases that are to be disabled temporarily.
|
||||
#
|
||||
# Separate the test case name and the comment with ':'.
|
||||
#
|
||||
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
|
||||
#
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
big_innodb_log : MDEV-20421 2019-08-26 wlad Always fails on Windows buildbot
|
||||
@@ -0,0 +1,9 @@
|
||||
--- encrypted_page_corruption,crc32.result
|
||||
+++ encrypted_page_corruption,full_crc32.result
|
||||
@@ -5,5 +5,5 @@
|
||||
# Corrupt the table
|
||||
# restart
|
||||
# xtrabackup backup
|
||||
-FOUND 1 /Database page corruption detected.*/ in backup.log
|
||||
+NOT FOUND /Database page corruption detected.*/ in backup.log
|
||||
drop table t1;
|
||||
@@ -0,0 +1,5 @@
|
||||
[crc32]
|
||||
--innodb-checksum-algorithm=crc32
|
||||
|
||||
[full_crc32]
|
||||
--innodb-checksum-algorithm=full_crc32
|
||||
@@ -4,4 +4,3 @@
|
||||
--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key
|
||||
--loose-file-key-management-filename=$MTR_SUITE_DIR/filekeys-data.enc
|
||||
--loose-file-key-management-encryption-algorithm=aes_cbc
|
||||
--innodb-checksum-algorithm=crc32
|
||||
|
||||
@@ -19,27 +19,36 @@ use warnings;
|
||||
use Fcntl qw(:DEFAULT :seek);
|
||||
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
|
||||
|
||||
my $page_size = $ENV{INNODB_PAGE_SIZE};
|
||||
my $ps = $ENV{INNODB_PAGE_SIZE};
|
||||
|
||||
sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/test/t1.ibd", O_RDWR
|
||||
|| die "Cannot open t1.ibd\n";
|
||||
sysread(IBD_FILE, $_, 38) || die "Cannot read t1.ibd\n";
|
||||
sysread(IBD_FILE, $_, 58) || die "Cannot read t1.ibd\n";
|
||||
my $space = unpack("x[34]N", $_);
|
||||
sysseek(IBD_FILE, $page_size * 3, SEEK_SET) || die "Cannot seek t1.ibd\n";
|
||||
my $full_crc32 = unpack("N",substr($_,54,4)) & 0x10; # FIL_SPACE_FLAGS
|
||||
sysseek(IBD_FILE, $ps * 3, SEEK_SET) || die "Cannot seek t1.ibd\n";
|
||||
|
||||
my $head = pack("Nx[18]", 3); # better to have a valid page number
|
||||
my $body = chr(0) x ($page_size - 38 - 8);
|
||||
# better to have a valid page number (3)
|
||||
my $page = pack("x[4]Nx[18]Nx[4]N", 3, 1, $space) . chr(0) x ($ps - 38);
|
||||
|
||||
# Calculate innodb_checksum_algorithm=crc32 for the unencrypted page.
|
||||
# The following bytes are excluded:
|
||||
# bytes 0..3 (the checksum is stored there)
|
||||
# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id)
|
||||
# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN)
|
||||
my $polynomial = 0x82f63b78; # CRC-32C
|
||||
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
||||
if ($full_crc32)
|
||||
{
|
||||
# no possibility of bug here
|
||||
my $ck = mycrc32(substr($page, 0, $ps - 4), 0, $polynomial);
|
||||
substr($page, $ps - 4, 4) = pack("N", $ck);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^
|
||||
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
|
||||
substr($page,0,4)=$ck;
|
||||
substr($page,$ps-8,4)=$ck;
|
||||
# trigger the bug by having the same "post-encryption" checksum!
|
||||
substr($page,30,4)=$ck;
|
||||
}
|
||||
|
||||
my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck);
|
||||
die unless syswrite(IBD_FILE, $page, $page_size) == $page_size;
|
||||
die unless syswrite(IBD_FILE, $page, $ps) == $ps;
|
||||
close IBD_FILE;
|
||||
EOF
|
||||
|
||||
@@ -49,8 +58,13 @@ echo # xtrabackup backup;
|
||||
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
|
||||
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
|
||||
|
||||
let $expect_error= 1;
|
||||
if (`select @@innodb_checksum_algorithm LIKE '%full_crc32'`)
|
||||
{
|
||||
let $expect_error= 0;
|
||||
}
|
||||
--disable_result_log
|
||||
--error 1
|
||||
--error $expect_error
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir --core-file > $backuplog;
|
||||
--enable_result_log
|
||||
|
||||
|
||||
@@ -28,29 +28,41 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v));
|
||||
ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v BIT(64) AS (a) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(v(100)));
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# PAD_CHAR_TO_FULL_LENGTH + TRIM resolving dependency
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) VIRTUAL, KEY(v));
|
||||
SHOW CREATE TABLE t1;
|
||||
@@ -126,67 +138,94 @@ t1 CREATE TABLE `t1` (
|
||||
DROP TABLE t1;
|
||||
# PAD_CHAR_TO_FULL_LENGTH + TRIM not resolving dependency
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v(100)));
|
||||
ERROR HY000: Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING '' FROM a)) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH '' FROM a)) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING 'x' FROM a)) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH 'x' FROM a)) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5),
|
||||
v VARCHAR(5) AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5),
|
||||
v VARCHAR(5) AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# PAD_CHAR_TO_FULL_LENGTH + TRIM(... non_constant FROM a)
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5),
|
||||
b CHAR(5),
|
||||
v TEXT AS (TRIM(TRAILING b FROM a)) VIRTUAL, KEY(v(100)));
|
||||
ERROR HY000: Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# PAD_CHAR_TO_FULL_LENGTH + RPAD resolving dependency
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,5,' ')) VIRTUAL, KEY(v));
|
||||
SHOW CREATE TABLE t1;
|
||||
@@ -226,22 +265,28 @@ t1 CREATE TABLE `t1` (
|
||||
DROP TABLE t1;
|
||||
# PAD_CHAR_TO_FULL_LENGTH + RPAD not resolving dependency
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,4,' ')) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5),
|
||||
b CHAR(5),
|
||||
v VARCHAR(5) AS (RPAD(a,NULL,b)) VIRTUAL,
|
||||
KEY(v)
|
||||
);
|
||||
ERROR HY000: Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# PAD_CHAR_TO_FULL_LENGTH + comparison
|
||||
CREATE TABLE t1 (a CHAR(5), v INT AS (a='a') VIRTUAL, KEY(v));
|
||||
SHOW CREATE TABLE t1;
|
||||
@@ -256,11 +301,14 @@ CREATE TABLE t1 (
|
||||
a CHAR(5) CHARACTER SET latin1 COLLATE latin1_nopad_bin,
|
||||
v INT AS (a='a') VIRTUAL, KEY(v)
|
||||
);
|
||||
ERROR HY000: Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# PAD_CHAR_TO_FULL_LENGTH + LIKE
|
||||
CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a%') VIRTUAL, KEY(v));
|
||||
SHOW CREATE TABLE t1;
|
||||
@@ -281,18 +329,24 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a') VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# PAD_CHAR_TO_FULL_LENGTH + LENGTH(char_column) = hard dependency
|
||||
CREATE TABLE t1 (a CHAR(5), v INT AS (LENGTH(a)) VIRTUAL, KEY(v));
|
||||
ERROR HY000: Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing NO_UNSIGNED_SUBTRACTION
|
||||
#
|
||||
@@ -302,33 +356,42 @@ b INT UNSIGNED,
|
||||
c INT GENERATED ALWAYS AS (a-b) VIRTUAL,
|
||||
KEY (c)
|
||||
);
|
||||
ERROR HY000: Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
c INT GENERATED ALWAYS AS (CAST(a AS SIGNED)-b) VIRTUAL,
|
||||
KEY (c)
|
||||
);
|
||||
ERROR HY000: Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
c INT GENERATED ALWAYS AS (a-CAST(b AS SIGNED)) VIRTUAL,
|
||||
KEY (c)
|
||||
);
|
||||
ERROR HY000: Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c`
|
||||
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
@@ -369,12 +432,16 @@ c CHAR(5),
|
||||
v VARCHAR(5) GENERATED ALWAYS AS (RPAD(c,a-b,' ')) VIRTUAL,
|
||||
KEY (v)
|
||||
);
|
||||
ERROR HY000: Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
@@ -382,11 +449,14 @@ c CHAR(5),
|
||||
v VARCHAR(5) GENERATED ALWAYS AS (RPAD(c,CAST(a AS DECIMAL(20,1))-b,' ')) VIRTUAL,
|
||||
KEY (v)
|
||||
);
|
||||
ERROR HY000: Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# ALTER TABLE ADD KEY(vcol_depending_on_sql_mode) --> error
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
@@ -395,32 +465,62 @@ c CHAR(5),
|
||||
v VARCHAR(5) GENERATED ALWAYS AS (c) VIRTUAL
|
||||
);
|
||||
ALTER TABLE t1 ADD KEY(v);
|
||||
ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
ALTER TABLE t1 DROP KEY v;
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
CREATE INDEX v ON t1 (v);
|
||||
ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# A virtual column on the second position in an index - cannot depend on sql_mode
|
||||
CREATE TABLE t1 (id int, a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(id, v(100)));
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
# A persisten virtual column cannot depend on sql_mode
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT);
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
|
||||
@@ -52,40 +52,66 @@ Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t2;
|
||||
FLUSH TABLES;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(5) DEFAULT NULL,
|
||||
`v` varchar(5) GENERATED ALWAYS AS (`a`) STORED
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1 ADD b INT DEFAULT a;
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(5) DEFAULT NULL,
|
||||
`v` varchar(5) GENERATED ALWAYS AS (`a`) STORED,
|
||||
`b` int(11) DEFAULT `a`
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
ALTER TABLE t1 ADD b INT DEFAULT a;
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(5) DEFAULT NULL,
|
||||
`v` varchar(5) GENERATED ALWAYS AS (`a`) STORED
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1;
|
||||
a v
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
a v b
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
FLUSH TABLES;
|
||||
ALTER TABLE t1 ADD c INT DEFAULT a;
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SELECT * FROM t1;
|
||||
a v
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
a v b c
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Fixing a Maria-10.2.26 table with a stored VARCHAR column
|
||||
@@ -177,10 +203,18 @@ Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t2;
|
||||
FLUSH TABLES;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -188,19 +222,33 @@ t1 CREATE TABLE `t1` (
|
||||
`v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL,
|
||||
KEY `v` (`v`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1 ADD b INT DEFAULT a;
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
ALTER TABLE t1 ADD b INT DEFAULT a;
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
FLUSH TABLES;
|
||||
ALTER TABLE t1 ADD c INT DEFAULT a;
|
||||
ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
SELECT * FROM t1;
|
||||
a v
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
a v b c
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
Warnings:
|
||||
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
|
||||
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Fixing a Maria-10.2.26 table with a virtual VARCHAR column
|
||||
|
||||
@@ -21,21 +21,25 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v));
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v BIT(64) AS (a) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(v(100)));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM resolving dependency
|
||||
@@ -75,52 +79,61 @@ DROP TABLE t1;
|
||||
|
||||
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM not resolving dependency
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v(100)));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING '' FROM a)) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH '' FROM a)) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING 'x' FROM a)) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH 'x' FROM a)) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
# more than one space
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5),
|
||||
v VARCHAR(5) AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
# more than one space
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5),
|
||||
v VARCHAR(5) AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM(... non_constant FROM a)
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5),
|
||||
b CHAR(5),
|
||||
v TEXT AS (TRIM(TRAILING b FROM a)) VIRTUAL, KEY(v(100)));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo # PAD_CHAR_TO_FULL_LENGTH + RPAD resolving dependency
|
||||
@@ -144,11 +157,12 @@ DROP TABLE t1;
|
||||
|
||||
--echo # PAD_CHAR_TO_FULL_LENGTH + RPAD not resolving dependency
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,4,' ')) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5),
|
||||
b CHAR(5),
|
||||
@@ -156,6 +170,7 @@ CREATE TABLE t1 (
|
||||
KEY(v)
|
||||
);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo # PAD_CHAR_TO_FULL_LENGTH + comparison
|
||||
@@ -164,12 +179,13 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a='a') VIRTUAL, KEY(v));
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a CHAR(5) CHARACTER SET latin1 COLLATE latin1_nopad_bin,
|
||||
v INT AS (a='a') VIRTUAL, KEY(v)
|
||||
);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo # PAD_CHAR_TO_FULL_LENGTH + LIKE
|
||||
@@ -182,23 +198,25 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE NULL) VIRTUAL, KEY(v));
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a') VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo # PAD_CHAR_TO_FULL_LENGTH + LENGTH(char_column) = hard dependency
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v INT AS (LENGTH(a)) VIRTUAL, KEY(v));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Testing NO_UNSIGNED_SUBTRACTION
|
||||
--echo #
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
@@ -206,8 +224,9 @@ CREATE TABLE t1 (
|
||||
KEY (c)
|
||||
);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
@@ -215,8 +234,9 @@ CREATE TABLE t1 (
|
||||
KEY (c)
|
||||
);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
@@ -224,6 +244,7 @@ CREATE TABLE t1 (
|
||||
KEY (c)
|
||||
);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
@@ -250,7 +271,7 @@ DROP TABLE t1;
|
||||
--echo # Comnination: PAD_CHAR_TO_FULL_LENGTH + NO_UNSIGNED_SUBTRACTION
|
||||
--echo #
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
@@ -259,13 +280,14 @@ CREATE TABLE t1 (
|
||||
KEY (v)
|
||||
);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# The below solves the dependency on NO_UNSIGNED_SUBTRACTION
|
||||
# but does not solve the dependency on PAD_CHAR_TO_FULL_LENGTH,
|
||||
# because the 'length' argument to RPAD() is not a constant.
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (
|
||||
a INT UNSIGNED,
|
||||
b INT UNSIGNED,
|
||||
@@ -274,6 +296,7 @@ CREATE TABLE t1 (
|
||||
KEY (v)
|
||||
);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
|
||||
@@ -291,10 +314,12 @@ CREATE TABLE t1 (
|
||||
c CHAR(5),
|
||||
v VARCHAR(5) GENERATED ALWAYS AS (c) VIRTUAL
|
||||
);
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
ALTER TABLE t1 ADD KEY(v);
|
||||
SHOW WARNINGS;
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
ALTER TABLE t1 DROP KEY v;
|
||||
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE INDEX v ON t1 (v);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
@@ -302,16 +327,18 @@ DROP TABLE t1;
|
||||
|
||||
--echo # A virtual column on the second position in an index - cannot depend on sql_mode
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (id int, a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(id, v(100)));
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo # A persisten virtual column cannot depend on sql_mode
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT);
|
||||
SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT);
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
@@ -25,19 +25,21 @@ SELECT * FROM t1;
|
||||
FLUSH TABLES;
|
||||
SELECT * FROM t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
DROP TABLE t2;
|
||||
FLUSH TABLES;
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
ALTER TABLE t1 ADD b INT DEFAULT a;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
FLUSH TABLES;
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
ALTER TABLE t1 ADD c INT DEFAULT a;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
@@ -90,18 +92,20 @@ SELECT * FROM t1;
|
||||
FLUSH TABLES;
|
||||
SELECT * FROM t1;
|
||||
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
DROP TABLE t2;
|
||||
FLUSH TABLES;
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
DROP TABLE t2;
|
||||
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
ALTER TABLE t1 ADD b INT DEFAULT a;
|
||||
FLUSH TABLES;
|
||||
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
|
||||
ALTER TABLE t1 ADD c INT DEFAULT a;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
Reference in New Issue
Block a user