mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 17:33:44 +01:00
f610296d98
extra/comp_err.c: Allow one to have multiple start-error-numbers in the same error.txt file. Generate 'empty' error strings for the missing error numbers in the errmsg.sys file mysql-test/r/bigint.result: Update results to use new error numbers mysql-test/r/dyncol.result: Update results to use new error numbers mysql-test/r/func_math.result: Update results to use new error numbers mysql-test/r/func_str.result: Update results to use new error numbers mysql-test/r/plugin.result: Update results to use new error numbers mysql-test/r/table_options.result: Update results to use new error numbers mysql-test/r/type_newdecimal.result: Update results to use new error numbers mysql-test/r/warnings.result: Update results to use new error numbers mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result: Update results to use new error numbers mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result: Update results to use new error numbers mysql-test/suite/vcol/r/vcol_misc.result: Update results to use new error numbers sql/derror.cc: Ensure we don't read a errmsg.sys with a missing required error message; This change was needed as errmsg.sys may now contain empty error messages between the MySQL and MariaDB error messages. If error message file didn't exist and we have not read one in the past, don't continue. Give better error message if the errmsg.sys header has changed. sql/share/errmsg.txt: Create new section, starting from 1900, for MariaDB error messages
365 lines
7.7 KiB
Text
365 lines
7.7 KiB
Text
SET @@session.storage_engine = 'MyISAM';
|
|
create table t1 (a int,
|
|
b int as (-a),
|
|
c int as (-a) persistent);
|
|
set sql_warnings = 1;
|
|
#
|
|
# *** INSERT ***
|
|
#
|
|
# INSERT INTO tbl_name VALUES... DEFAULT is specified against vcols
|
|
insert into t1 values (1,default,default);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# INSERT INTO tbl_name VALUES... NULL is specified against vcols
|
|
insert into t1 values (1,null,null);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols
|
|
insert into t1 values (1,2,3);
|
|
Warnings:
|
|
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
|
|
Warning 1906 The value specified for computed column 'c' in table 't1' ignored
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# INSERT INTO tbl_name (<non_vcol_list>) VALUES...
|
|
insert into t1 (a) values (1), (2);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# INSERT INTO tbl_name (<normal+vcols>) VALUES... DEFAULT is specified
|
|
# against vcols
|
|
insert into t1 (a,b) values (1,default), (2,default);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# INSERT INTO tbl_name (<normal+vcols>) VALUES... NULL is specified against vcols
|
|
insert into t1 (a,b) values (1,null), (2,null);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# INSERT INTO tbl_name (<normal+vcols>) VALUES... a non-NULL value is specified
|
|
# against vcols
|
|
insert into t1 (a,b) values (1,3), (2,4);
|
|
Warnings:
|
|
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
|
|
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
drop table t1;
|
|
# Table with UNIQUE non-vcol field. INSERT INTO tbl_name VALUES... ON DUPLICATE
|
|
# KEY UPDATE <non_vcol>=expr, <vcol>=expr
|
|
create table t1 (a int unique,
|
|
b int as (-a),
|
|
c int as (-a) persistent);
|
|
insert into t1 values (1,default,default);
|
|
insert into t1 values (1,default,default)
|
|
on duplicate key update a=2, b=default;
|
|
select a,b,c from t1;
|
|
a b c
|
|
2 -2 -2
|
|
delete from t1 where b in (1,2);
|
|
select * from t1;
|
|
a b c
|
|
2 -2 -2
|
|
drop table t1;
|
|
# Table with UNIQUE vcol field. INSERT INTO tbl_name VALUES... ON DUPLICATE
|
|
# KEY UPDATE <non_vcol>=expr, <vcol>=expr
|
|
create table t1 (a int,
|
|
b int as (-a),
|
|
c int as (-a) persistent unique);
|
|
insert into t1 values (1,default,default);
|
|
insert into t1 values (1,default,default)
|
|
on duplicate key update a=2, b=default;
|
|
select a,b,c from t1;
|
|
a b c
|
|
2 -2 -2
|
|
# CREATE new_table ... LIKE old_table
|
|
# INSERT INTO new_table SELECT * from old_table
|
|
create table t2 like t1;
|
|
insert into t2 select * from t1;
|
|
Warnings:
|
|
Warning 1906 The value specified for computed column 'b' in table 't2' ignored
|
|
Warning 1906 The value specified for computed column 'c' in table 't2' ignored
|
|
select * from t1;
|
|
a b c
|
|
2 -2 -2
|
|
drop table t2;
|
|
# CREATE new_table ... LIKE old_table INSERT INTO new_table (<non-vcols>, <vcols>)
|
|
# SELECT <non-vcols>, <vcols> from old_table
|
|
insert into t1 values (1,default,default);
|
|
select * from t1;
|
|
a b c
|
|
2 -2 -2
|
|
1 -1 -1
|
|
create table t2 like t1;
|
|
insert into t2 (a,b) select a,b from t1;
|
|
Warnings:
|
|
Warning 1906 The value specified for computed column 'b' in table 't2' ignored
|
|
Warning 1906 The value specified for computed column 'b' in table 't2' ignored
|
|
select * from t2;
|
|
a b c
|
|
2 -2 -2
|
|
1 -1 -1
|
|
drop table t2;
|
|
drop table t1;
|
|
#
|
|
# *** UPDATE ***
|
|
#
|
|
# UPDATE tbl_name SET non-vcol=expr WHERE non-vcol=expr
|
|
create table t1 (a int,
|
|
b int as (-a),
|
|
c int as (-a) persistent);
|
|
insert into t1 (a) values (1), (2);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
update t1 set a=3 where a=2;
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
3 -3 -3
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# UPDATE tbl_name SET vcol=expr WHERE non-vcol=expr
|
|
insert into t1 (a) values (1), (2);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
update t1 set c=3 where a=2;
|
|
Warnings:
|
|
Warning 1906 The value specified for computed column 'c' in table 't1' ignored
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# UPDATE tbl_name SET non-vcol=expr WHERE vcol=expr
|
|
insert into t1 (a) values (1), (2);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
update t1 set a=3 where b=-2;
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
3 -3 -3
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# UPDATE tbl_name SET vcol=expr WHERE vcol=expr
|
|
insert into t1 (a) values (1), (2);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
update t1 set c=3 where b=-2;
|
|
Warnings:
|
|
Warning 1906 The value specified for computed column 'c' in table 't1' ignored
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
drop table t1;
|
|
# INDEX created on vcol
|
|
# UPDATE tbl_name SET non-vcol=expr WHERE vcol=const
|
|
create table t1 (a int,
|
|
b int as (-a),
|
|
c int as (-a) persistent unique);
|
|
insert into t1 (a) values (1), (2);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
update t1 set a=3 where c=-2;
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
3 -3 -3
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# INDEX created on vcol
|
|
# UPDATE tbl_name SET non-vcol=expr WHERE vcol=between const1 and const2
|
|
insert into t1 (a) values (1), (2);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
update t1 set a=3 where c between -3 and -2;
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
3 -3 -3
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# No INDEX created on vcol
|
|
# UPDATE tbl_name SET non-vcol=expr WHERE vcol=between const1 and const2
|
|
insert into t1 (a) values (1), (2);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
update t1 set a=3 where b between -3 and -2;
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
3 -3 -3
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c
|
|
# INDEX created on vcol
|
|
# UPDATE tbl_name SET non-vcol=expr
|
|
# WHERE vcol=between const1 and const2 ORDER BY vcol
|
|
insert into t1 (a) values (1), (2), (3), (4), (5);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
3 -3 -3
|
|
4 -4 -4
|
|
5 -5 -5
|
|
update t1 set a=6 where c between -1 and 0
|
|
order by c;
|
|
select * from t1;
|
|
a b c
|
|
6 -6 -6
|
|
2 -2 -2
|
|
3 -3 -3
|
|
4 -4 -4
|
|
5 -5 -5
|
|
delete from t1 where c between -6 and 0;
|
|
select * from t1;
|
|
a b c
|
|
# INDEX created on vcol
|
|
# UPDATE tbl_name SET non-vcol=expr
|
|
# WHERE vcol=between const1 and const2 ORDER BY vcol LIMIT 2
|
|
insert into t1 (a) values (1), (2), (3), (4), (5);
|
|
select * from t1;
|
|
a b c
|
|
5 -5 -5
|
|
4 -4 -4
|
|
3 -3 -3
|
|
2 -2 -2
|
|
1 -1 -1
|
|
update t1 set a=6 where c between -1 and 0
|
|
order by c limit 2;
|
|
select * from t1;
|
|
a b c
|
|
5 -5 -5
|
|
4 -4 -4
|
|
3 -3 -3
|
|
2 -2 -2
|
|
6 -6 -6
|
|
delete from t1 where c between -2 and 0 order by c;
|
|
select * from t1;
|
|
a b c
|
|
5 -5 -5
|
|
4 -4 -4
|
|
3 -3 -3
|
|
6 -6 -6
|
|
delete from t1;
|
|
# INDEX created on vcol
|
|
# UPDATE tbl_name SET non-vcol=expr
|
|
# WHERE indexed vcol=between const1 and const2 and non-indexed vcol=const3
|
|
insert into t1 (a) values (1), (2), (3), (4), (5);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
3 -3 -3
|
|
4 -4 -4
|
|
5 -5 -5
|
|
update t1 set a=6 where (c between -2 and 0) and (b=-1);
|
|
select * from t1;
|
|
a b c
|
|
6 -6 -6
|
|
2 -2 -2
|
|
3 -3 -3
|
|
4 -4 -4
|
|
5 -5 -5
|
|
delete from t1;
|
|
# INDEX created on vcol
|
|
# UPDATE tbl_name SET non-vcol=expr
|
|
# WHERE indexed vcol=between const1 and const2 and non-indexed vcol=const3
|
|
# ORDER BY indexed vcol
|
|
insert into t1 (a) values (1), (2), (3), (4), (5);
|
|
select * from t1;
|
|
a b c
|
|
1 -1 -1
|
|
2 -2 -2
|
|
3 -3 -3
|
|
4 -4 -4
|
|
5 -5 -5
|
|
update t1 set a=6 where (c between -2 and 0) and (b=-1) order by c;
|
|
select * from t1;
|
|
a b c
|
|
6 -6 -6
|
|
2 -2 -2
|
|
3 -3 -3
|
|
4 -4 -4
|
|
5 -5 -5
|
|
delete from t1;
|
|
drop table t1;
|
|
#
|
|
# *** REPLACE ***
|
|
#
|
|
# UNIQUE INDEX on vcol
|
|
# REPLACE tbl_name (non-vcols) VALUES (non-vcols);
|
|
create table t1 (a int,
|
|
b int as (-a),
|
|
c int as (-a) persistent unique,
|
|
d varchar(16));
|
|
insert into t1 (a,d) values (1,'a'), (2,'b');
|
|
select * from t1;
|
|
a b c d
|
|
1 -1 -1 a
|
|
2 -2 -2 b
|
|
replace t1 (a,d) values (1,'c');
|
|
select * from t1;
|
|
a b c d
|
|
1 -1 -1 c
|
|
2 -2 -2 b
|
|
delete from t1;
|
|
select * from t1;
|
|
a b c d
|
|
set sql_warnings = 0;
|
|
drop table t1;
|