Commit db7edfed authored by Michael Widenius's avatar Michael Widenius Committed by Sergei Golubchik

MDEV-7563 Support CHECK constraint as in (or close to) SQL Standard

MDEV-10134 Add full support for DEFAULT

- Added support for using tables with MySQL 5.7 virtual fields,
  including MySQL 5.7 syntax
- Better error messages also for old cases
- CREATE ... SELECT now also updates timestamp columns
- Blob can now have default values
- Added new system variable "check_constraint_checks", to turn of
  CHECK constraint checking if needed.
- Removed some engine independent tests in suite vcol to only test myisam
- Moved some tests from 'include' to 't'. Should some day be done for all tests.
- FRM version increased to 11 if one uses virtual fields or constraints
- Changed to use a bitmap to check if a field has got a value, instead of
  setting HAS_EXPLICIT_VALUE bit in field flags
- Expressions can now be up to 65K in total
- Ensure we are not refering to uninitialized fields when handling virtual fields or defaults
- Changed check_vcol_func_processor() to return a bitmap of used types
- Had to change some functions that calculated cached value in fix_fields to do
  this in val() or getdate() instead.
- store_now_in_TIME() now takes a THD argument
- fill_record() now updates default values
- Add a lookahead for NOT NULL, to be able to handle DEFAULT 1+1 NOT NULL
- Automatically generate a name for constraints that doesn't have a name
- Added support for ALTER TABLE DROP CONSTRAINT
- Ensure that partition functions register virtual fields used. This fixes
  some bugs when using virtual fields in a partitioning function
parent 23d03a1b
......@@ -158,8 +158,6 @@ enum enum_server_command
#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */
#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
#define FIELD_IS_DROPPED (1<< 26) /* Intern: Field is being dropped */
#define HAS_EXPLICIT_VALUE (1 << 27) /* An INSERT/UPDATE operation supplied
an explicit default value */
#define REFRESH_GRANT (1ULL << 0) /* Refresh grant tables */
#define REFRESH_LOG (1ULL << 1) /* Start on new log file */
......
......@@ -126,7 +126,7 @@ SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
--disable_query_log
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 2 type mismatch.* 1535");
call mtr.add_suppression("Slave.*Can.t DROP .c7.; check that column.key exists.* error.* 1091");
call mtr.add_suppression("Slave.*Can.t DROP .c7.; check that .* exists.* error.* 1091");
call mtr.add_suppression("Slave.*Unknown column .c7. in .t15.* error.* 1054");
call mtr.add_suppression("Slave.*Key column .c6. doesn.t exist in table.* error.* 1072");
call mtr.add_suppression("Slave SQL.*Column 2 of table .test.t1.. cannot be converted from type.* error.* 1677");
......
......@@ -4,51 +4,43 @@ SET TIME_ZONE = "+00:00";
--echo # Test of errors for column data types that dont support function
--echo # defaults.
--echo #
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a BIT DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a TINYINT DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a SMALLINT DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a MEDIUMINT DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a INT DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a BIGINT DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a FLOAT DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a DECIMAL DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a DATE DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a TIME DEFAULT $current_timestamp );
--error ER_INVALID_DEFAULT
eval CREATE TABLE t1( a YEAR DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a BIT DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a INT DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a DATE DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a TIME DEFAULT $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a YEAR DEFAULT $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a BIT ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a BIT ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a TINYINT ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a SMALLINT ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a MEDIUMINT ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a INT ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a INT ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a BIGINT ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a FLOAT ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a DECIMAL ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a DATE ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a DATE ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a TIME ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a TIME ON UPDATE $current_timestamp );
--error ER_INVALID_ON_UPDATE
eval CREATE TABLE t1( a YEAR ON UPDATE $current_timestamp );
eval CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE $current_timestamp );
drop table if exists t1;
--echo #
--echo # Test that the default clause behaves like NOW() regarding time zones.
......@@ -1066,7 +1058,7 @@ SELECT * FROM v1;
--echo # 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
--error ER_VIEW_CHECK_FAILED
--error ER_CONSTRAINT_FAILED
UPDATE v1 SET a = 2;
SELECT * FROM t1;
......@@ -1091,7 +1083,7 @@ SELECT * FROM v1;
SET TIMESTAMP = 1.126789;
--error ER_VIEW_CHECK_FAILED
--error ER_CONSTRAINT_FAILED
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
SELECT * FROM v1;
......
......@@ -414,12 +414,12 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP PRIMARY KEY;
ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
ERROR 42000: Can't DROP 'PRIMARY'; check that constraint/column/key exists
DROP TABLE t1;
create table t1 (a int, b int, key(a));
insert into t1 values (1,1), (2,2);
alter table t1 drop key no_such_key;
ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists
ERROR 42000: Can't DROP 'no_such_key'; check that constraint/column/key exists
alter table t1 drop key a;
drop table t1;
CREATE TABLE T12207(a int) ENGINE=MYISAM;
......@@ -1374,7 +1374,7 @@ Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings:
Note 1091 Can't DROP 'lol'; check that column/key exists
Note 1091 Can't DROP 'lol'; check that constraint/column/key exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings:
......@@ -1385,7 +1385,7 @@ Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1;
Warnings:
Note 1091 Can't DROP 'x_param'; check that column/key exists
Note 1091 Can't DROP 'x_param'; check that constraint/column/key exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings:
......@@ -1416,7 +1416,7 @@ Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings:
Note 1091 Can't DROP 'lol'; check that column/key exists
Note 1091 Can't DROP 'lol'; check that constraint/column/key exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings:
......@@ -1427,7 +1427,7 @@ Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1;
Warnings:
Note 1091 Can't DROP 'x_param'; check that column/key exists
Note 1091 Can't DROP 'x_param'; check that constraint/column/key exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings:
......@@ -1447,7 +1447,7 @@ Note 1061 Duplicate key name 'fk'
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
Warnings:
Note 1091 Can't DROP 'fk'; check that column/key exists
Note 1091 Can't DROP 'fk'; check that constraint/column/key exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -1461,7 +1461,7 @@ Note 1061 Duplicate key name 't2_ibfk_1'
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
Warnings:
Note 1091 Can't DROP 't2_ibfk_1'; check that column/key exists
Note 1091 Can't DROP 't2_ibfk_1'; check that constraint/column/key exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -1486,10 +1486,10 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id;
Warnings:
Note 1091 Can't DROP 'k_id'; check that column/key exists
Note 1091 Can't DROP 'k_id'; check that constraint/column/key exists
ALTER TABLE t2 DROP COLUMN a, DROP COLUMN IF EXISTS a;
Warnings:
Note 1091 Can't DROP 'a'; check that column/key exists
Note 1091 Can't DROP 'a'; check that constraint/column/key exists
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -1667,6 +1667,8 @@ ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
affected rows: 0
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
ALTER ONLINE TABLE m1 ADD COLUMN c int;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED.
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= SHARED;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
......
set @save_check_constraint=@@check_constraint_checks;
create table t1 (a int check(a>10), b int check (b > 20), constraint `min` check (a+b > 100), constraint `max` check (a+b <500)) engine=myisam;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL CHECK (a>10),
`b` int(11) DEFAULT NULL CHECK (b > 20),
CONSTRAINT `min` CHECK (a+b > 100),
CONSTRAINT `max` CHECK (a+b <500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (100,100);
insert into t1 values (1,1);
ERROR HY000: CONSTRAINT 'a' failed for 'test.t1'
insert into t1 values (20,1);
ERROR HY000: CONSTRAINT 'b' failed for 'test.t1'
insert into t1 values (20,30);
ERROR HY000: CONSTRAINT 'min' failed for 'test.t1'
insert into t1 values (500,500);
ERROR HY000: CONSTRAINT 'max' failed for 'test.t1'
insert into t1 values (101,101),(102,102),(600,600),(103,103);
ERROR HY000: CONSTRAINT 'max' failed for 'test.t1'
select * from t1;
a b
100 100
101 101
102 102
truncate table t1;
insert ignore into t1 values (101,101),(102,102),(600,600),(103,103);
Warnings:
Warning 1369 CONSTRAINT 'max' failed for 'test.t1'
select * from t1;
a b
101 101
102 102
103 103
set check_constraint_checks=0;
truncate table t1;
insert into t1 values (101,101),(102,102),(600,600),(103,103);
select * from t1;
a b
101 101
102 102
600 600
103 103
set check_constraint_checks=@save_check_constraint;
alter table t1 add c int default 0 check (c < 10);
ERROR HY000: CONSTRAINT 'max' failed for table
set check_constraint_checks=0;
alter table t1 add c int default 0 check (c < 10);
alter table t1 add check (a+b+c < 500);
set check_constraint_checks=@save_check_constraint;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL CHECK (a>10),
`b` int(11) DEFAULT NULL CHECK (b > 20),
`c` int(11) DEFAULT '0' CHECK (c < 10),
CONSTRAINT `min` CHECK (a+b > 100),
CONSTRAINT `max` CHECK (a+b <500),
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values(105,105,105);
ERROR HY000: CONSTRAINT 'c' failed for 'test.t1'
insert into t1 values(249,249,9);
ERROR HY000: CONSTRAINT 'CONSTRAINT_1' failed for 'test.t1'
insert into t1 values(105,105,9);
select * from t1;
a b c
101 101 0
102 102 0
600 600 0
103 103 0
105 105 9
create table t2 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL CHECK (a>10),
`b` int(11) DEFAULT NULL CHECK (b > 20),
`c` int(11) DEFAULT '0' CHECK (c < 10),
CONSTRAINT `min` CHECK (a+b > 100),
CONSTRAINT `max` CHECK (a+b <500),
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t2 drop constraint c;
ERROR 42000: Can't DROP 'c'; check that constraint/column/key exists
alter table t2 drop constraint min;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL CHECK (a>10),
`b` int(11) DEFAULT NULL CHECK (b > 20),
`c` int(11) DEFAULT '0' CHECK (c < 10),
CONSTRAINT `max` CHECK (a+b <500),
CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
drop table if exists t1;
create table t1 (a int check (a>0));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL CHECK (a>0)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1);
insert into t1 values (0);
ERROR HY000: CONSTRAINT 'a' failed for 'test.t1'
drop table t1;
create table t1 (a int, b int, check (a>b));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (a>b)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0);
insert into t1 values (0,1);
ERROR HY000: CONSTRAINT 'CONSTRAINT_1' failed for 'test.t1'
drop table t1;
create table t1 (a int ,b int, constraint abc check (a>b));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `abc` CHECK (a>b)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1,0);
insert into t1 values (0,1);
ERROR HY000: CONSTRAINT 'abc' failed for 'test.t1'
drop table t1;
create table t1 (a int null);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (1),(NULL);
drop table t1;
create table t1 (a int null);
......
......@@ -363,7 +363,7 @@ t1 CREATE TABLE `t1` (
DROP INDEX IF EXISTS i1 ON t1;
DROP INDEX IF EXISTS i1 ON t1;
Warnings:
Note 1091 Can't DROP 'i1'; check that column/key exists
Note 1091 Can't DROP 'i1'; check that constraint/column/key exists
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
......
......@@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP INDEX IF EXISTS i1 ON t1;
Warnings:
Note 1091 Can't DROP 'i1'; check that column/key exists
Note 1091 Can't DROP 'i1'; check that constraint/column/key exists
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
......
This diff is collapsed.
......@@ -8,8 +8,6 @@ KEY kt(tag),
KEY kv(value(15)),
FULLTEXT KEY kvf(value)
) ENGINE=MyISAM;
Warnings:
Warning 1101 BLOB/TEXT column 'value' can't have a default value
CREATE TABLE t2 (
id_t2 mediumint unsigned NOT NULL default '0',
id_t1 mediumint unsigned NOT NULL default '0',
......
......@@ -9,8 +9,6 @@ name VARCHAR(80) DEFAULT '' NOT NULL,
FULLTEXT(url,description,shortdesc,longdesc),
PRIMARY KEY(gnr)
);
Warnings:
Warning 1101 BLOB/TEXT column 'longdesc' can't have a default value
insert into test (url,shortdesc,longdesc,description,name) VALUES
("http:/test.at", "kurz", "lang","desc", "name");
insert into test (url,shortdesc,longdesc,description,name) VALUES
......
......@@ -319,6 +319,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not((`test`.`t1`.`a` + 0)))
select not 1, not null, not not null, 1 is not null;
not 1 NULL not not null 1 is not null
0 NULL NULL 1
drop table t1;
#
# Start of 10.0 tests
......
......@@ -9,50 +9,40 @@ SET TIME_ZONE = "+00:00";
# Test of errors for column data types that dont support function
# defaults.
#
CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
drop table if exists t1;
#
# Test that the default clause behaves like NOW() regarding time zones.
#
......@@ -864,8 +854,8 @@ SET TIMESTAMP = 2000.876543;
INSERT INTO t2( a ) VALUES ( 3 );
SELECT * FROM t2;
b a
0000-00-00 00:00:00 1
0000-00-00 00:00:00 2
1970-01-01 00:16:40 1
1970-01-01 00:16:40 2
1970-01-01 00:33:20 3
DROP TABLE t1, t2;
#
......@@ -1453,7 +1443,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM t1;
a b
1 1970-01-01 03:16:40
......@@ -1476,7 +1466,7 @@ a c
1973-08-14 09:11:22 1
SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM v1;
a c
1973-08-14 09:11:22 1
......@@ -1565,50 +1555,40 @@ SET TIME_ZONE = "+00:00";
# Test of errors for column data types that dont support function
# defaults.
#
CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
drop table if exists t1;
#
# Test that the default clause behaves like NOW() regarding time zones.
#
......@@ -2420,8 +2400,8 @@ SET TIMESTAMP = 2000.876543;
INSERT INTO t2( a ) VALUES ( 3 );
SELECT * FROM t2;
b a
0000-00-00 00:00:00.000000 1
0000-00-00 00:00:00.000000 2
1970-01-01 00:16:40.987654 1
1970-01-01 00:16:40.987654 2
1970-01-01 00:33:20.876543 3
DROP TABLE t1, t2;
#
......@@ -3009,7 +2989,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM t1;
a b
1 1970-01-01 03:16:40.123456
......@@ -3032,7 +3012,7 @@ a c
1973-08-14 09:11:22.089786 1
SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM v1;
a c
1973-08-14 09:11:22.089786 1
......
......@@ -10,50 +10,40 @@ SET TIME_ZONE = "+00:00";
# Test of errors for column data types that dont support function
# defaults.
#
CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP );
CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
drop table if exists t1;
#
# Test that the default clause behaves like NOW() regarding time zones.
#
......@@ -865,8 +855,8 @@ SET TIMESTAMP = 2000.876543;
INSERT INTO t2( a ) VALUES ( 3 );
SELECT * FROM t2;
b a
0000-00-00 00:00:00 1
0000-00-00 00:00:00 2
1970-01-01 00:16:40 1
1970-01-01 00:16:40 2
1970-01-01 00:33:20 3
DROP TABLE t1, t2;
#
......@@ -1454,7 +1444,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM t1;
a b
1 1970-01-01 03:16:40
......@@ -1477,7 +1467,7 @@ a c
1973-08-14 09:11:22 1
SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM v1;
a c
1973-08-14 09:11:22 1
......@@ -1566,50 +1556,40 @@ SET TIME_ZONE = "+00:00";
# Test of errors for column data types that dont support function
# defaults.
#
CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) );
ERROR 42000: Invalid default value for 'a'
CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) );
CREATE OR REPLACE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) );
ERROR HY000: Invalid ON UPDATE clause for 'a' column
drop table if exists t1;
#
# Test that the default clause behaves like NOW() regarding time zones.
#
......@@ -2421,8 +2401,8 @@ SET TIMESTAMP = 2000.876543;
INSERT INTO t2( a ) VALUES ( 3 );
SELECT * FROM t2;
b a
0000-00-00 00:00:00.000000 1
0000-00-00 00:00:00.000000 2
1970-01-01 00:16:40.987654 1
1970-01-01 00:16:40.987654 2
1970-01-01 00:33:20.876543 3
DROP TABLE t1, t2;
#
......@@ -3010,7 +2990,7 @@ a b
# 1970-01-01 03:33:20
SET TIMESTAMP = 2000.000234;
UPDATE v1 SET a = 2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM t1;
a b
1 1970-01-01 03:16:40.123456
......@@ -3033,7 +3013,7 @@ a c
1973-08-14 09:11:22.089786 1
SET TIMESTAMP = 1.126789;
INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM v1;
a c
1973-08-14 09:11:22.089786 1
......
......@@ -804,8 +804,6 @@ INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
......@@ -822,8 +820,6 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
......@@ -838,8 +834,6 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
......
......@@ -614,8 +614,6 @@ t1 CREATE TABLE `t1` (
drop table t1;
CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
geometry NOT NULL default '') ENGINE=MyISAM ;
Warnings:
Warning 1101 BLOB/TEXT column 'geo' can't have a default value
insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
......
......@@ -576,6 +576,7 @@ select s1 from t1 where s1 in (select version from
information_schema.tables) union select version from
information_schema.tables;
s1
11
10
drop table t1;
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
......
......@@ -601,8 +601,6 @@ id int(11) DEFAULT '0' NOT NULL,
name tinytext DEFAULT '' NOT NULL,
UNIQUE id (id)
);
Warnings:
Warning 1101 BLOB/TEXT column 'name' can't have a default value
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
CREATE TABLE t2 (
id int(11) DEFAULT '0' NOT NULL,
......
......@@ -612,8 +612,6 @@ id int(11) DEFAULT '0' NOT NULL,
name tinytext DEFAULT '' NOT NULL,
UNIQUE id (id)
);
Warnings:
Warning 1101 BLOB/TEXT column 'name' can't have a default value
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
CREATE TABLE t2 (
id int(11) DEFAULT '0' NOT NULL,
......
......@@ -467,7 +467,7 @@ alter table t1 drop index c2, add index (c2(4),c3(7));
alter table t1 add primary key (c1, c2), drop primary key;
alter table t1 drop primary key;
alter table t1 add primary key (c1, c2), drop primary key;
ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists
ERROR 42000: Can't DROP 'PRIMARY'; check that constraint/column/key exists
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......
#
# Test that we can use tables created in MySQL 5.7
#
SHOW CREATE TABLE mysql57_virtual;
Table Create Table
mysql57_virtual CREATE TABLE `mysql57_virtual` (
`a` int(11) DEFAULT NULL,
`b` int(11) AS ((`a` + 1)) VIRTUAL,
`c` int(11) AS ((`a` + 3)) PERSISTENT
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into mysql57_virtual (a) values (1),(2);
select * from mysql57_virtual;
a b c
1 2 4
2 3 5
alter online table mysql57_virtual comment "I am now a MariaDB table";
ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
alter table mysql57_virtual comment "I am now a MariaDB table";
SHOW CREATE TABLE mysql57_virtual;
Table Create Table
mysql57_virtual CREATE TABLE `mysql57_virtual` (
`a` int(11) DEFAULT NULL,
`b` int(11) AS ((`a` + 1)) VIRTUAL,
`c` int(11) AS ((`a` + 3)) PERSISTENT
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='I am now a MariaDB table'
DROP TABLE mysql57_virtual;
#
# Check MySQL 5.7 syntax
#
create table t1 (a int, b int generated always as (a+1) STORED, c int generated always as (a+2) VIRTUAL);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) AS (a+1) PERSISTENT,
`c` int(11) AS (a+2) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
......@@ -29,7 +29,7 @@ BEGIN
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -60,7 +60,7 @@ BEGIN
use `foo`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
This diff is collapsed.
......@@ -31,7 +31,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=X/*!*/;
SET @@session.pseudo_thread_id=4/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -284,11 +284,7 @@ info text NOT NULL default '',
ipnr varchar(30) NOT NULL default '',
PRIMARY KEY (member_id)
) ENGINE=MyISAM PACK_KEYS=1;
Warnings:
Warning 1101 BLOB/TEXT column 'info' can't have a default value
insert into t1 (member_id) values (1),(2),(3);
Warnings:
Warning 1364 Field 'info' doesn't have a default value
select member_id, nickname, voornaam FROM t1
ORDER by lastchange_datum DESC LIMIT 2;
member_id nickname voornaam
......
......@@ -126,7 +126,7 @@ HANDLER_WRITE 2
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
INSERT INTO v1 VALUES (31);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
......@@ -135,7 +135,7 @@ HANDLER_TMP_WRITE 22
# 2 locks (1 table, all partitions pruned)
FLUSH STATUS;
INSERT INTO v1 VALUES (32);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
......
......@@ -27,6 +27,6 @@ drop table t1;
CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
REPLACE INTO v1 (f1) VALUES (1);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
DROP TABLE t1;
DROP VIEW v1;
......@@ -1932,7 +1932,7 @@ create table t1(id int);
create table t2(id int);
create table t3(flag int);
select (select * from t3 where id not null) from t1, t2;
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 'null) from t1, t2' at line 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 'not null) from t1, t2' at line 1
drop table t1,t2,t3;
CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT);
......@@ -5001,7 +5001,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
SELECT * FROM v1;
c
1
......
......@@ -1936,7 +1936,7 @@ create table t1(id int);
create table t2(id int);
create table t3(flag int);
select (select * from t3 where id not null) from t1, t2;
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 'null) from t1, t2' at line 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 'not null) from t1, t2' at line 1
drop table t1,t2,t3;
CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT);
......@@ -5003,7 +5003,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
SELECT * FROM v1;
c
1
......
......@@ -1939,7 +1939,7 @@ create table t1(id int);
create table t2(id int);
create table t3(flag int);
select (select * from t3 where id not null) from t1, t2;
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 'null) from t1, t2' at line 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 'not null) from t1, t2' at line 1
drop table t1,t2,t3;
CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT);
......@@ -5001,7 +5001,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
SELECT * FROM v1;
c
1
......
......@@ -1935,7 +1935,7 @@ create table t1(id int);
create table t2(id int);
create table t3(flag int);
select (select * from t3 where id not null) from t1, t2;
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 'null) from t1, t2' at line 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 'not null) from t1, t2' at line 1
drop table t1,t2,t3;
CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT);
......@@ -4997,7 +4997,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
SELECT * FROM v1;
c
1
......
......@@ -1938,7 +1938,7 @@ create table t1(id int);
create table t2(id int);
create table t3(flag int);
select (select * from t3 where id not null) from t1, t2;
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 'null) from t1, t2' at line 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 'not null) from t1, t2' at line 1
drop table t1,t2,t3;
CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT);
......@@ -5007,7 +5007,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
SELECT * FROM v1;
c
1
......
......@@ -1935,7 +1935,7 @@ create table t1(id int);
create table t2(id int);
create table t3(flag int);
select (select * from t3 where id not null) from t1, t2;
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 'null) from t1, t2' at line 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 'not null) from t1, t2' at line 1
drop table t1,t2,t3;
CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT);
......@@ -4997,7 +4997,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
INSERT INTO v2(a,b) VALUES (2,2);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
SELECT * FROM v1;
c
1
......
......@@ -37,10 +37,20 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT
CREATE TABLE t2 (a char(256));
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
CREATE TABLE t1 (a varchar(70000) default "hello");
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
Warnings:
Note 1246 Converting column 'a' from VARCHAR to TEXT
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` mediumtext DEFAULT "hello"
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 (a blob default "hello");
ERROR 42000: BLOB/TEXT column 'a' can't have a default value
drop table if exists t1,t2;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` blob DEFAULT "hello"
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
insert into t1 values (null,"a","A");
insert into t1 values (null,"bbb","BBB");
......@@ -503,11 +513,7 @@ foobar boggle
fish 10
drop table t1;
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
Warnings:
Warning 1101 BLOB/TEXT column 'imagem' can't have a default value
insert into t1 (id) values (1);
Warnings:
Warning 1364 Field 'imagem' doesn't have a default value
select
charset(load_file('../../std_data/words.dat')),
collation(load_file('../../std_data/words.dat')),
......@@ -793,21 +799,24 @@ NULL
620000000000
drop table t1;
create table t1 (a text default '');
Warnings:
Warning 1101 BLOB/TEXT column 'a' can't have a default value
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text DEFAULT NULL
`a` text DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (default);
select * from t1;
a
NULL
drop table t1;
set @@sql_mode='TRADITIONAL';
create table t1 (a text default '');
ERROR 42000: BLOB/TEXT column 'a' can't have a default value
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @@sql_mode='';
CREATE TABLE t (c TEXT CHARSET ASCII);
INSERT INTO t (c) VALUES (REPEAT('1',65537));
......@@ -879,9 +888,9 @@ CREATE TABLE b15776 (a char(4294967295));
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
CREATE TABLE b15776 (a char(4294967296));
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
CREATE TABLE b15776 (a year(4294967295));
CREATE TABLE b15776 (a year(?));
Warnings:
Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
Note 1287 'YEAR(?)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
INSERT INTO b15776 VALUES (42);
SELECT * FROM b15776;
a
......
......@@ -38,9 +38,6 @@ KEY (ulong),
KEY (ulonglong,ulong),
KEY (options,flags)
);
Warnings:
Warning 1101 BLOB/TEXT column 'mediumblob_col' can't have a default value
Warning 1101 BLOB/TEXT column 'longblob_col' can't have a default value
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(5) unsigned NULL NO PRI NULL auto_increment #
......@@ -63,8 +60,8 @@ time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
blob_col blob NULL YES NULL #
tinyblob_col tinyblob NULL YES NULL #
mediumblob_col mediumblob NULL NO NULL #
longblob_col longblob NULL NO NULL #
mediumblob_col mediumblob NULL NO '' #
longblob_col longblob NULL NO '' #
options enum('one','two','tree') latin1_swedish_ci NO MUL NULL #
flags set('one','two','tree') latin1_swedish_ci NO #
show keys from t1;
......@@ -129,9 +126,6 @@ Warning 1264 Out of range value for column 'ushort' at row 1
Warning 1264 Out of range value for column 'umedium' at row 1
Warning 1265 Data truncated for column 'options' at row 1
insert into t1 (tiny) values (1);
Warnings:
Warning 1364 Field 'mediumblob_col' doesn't have a default value
Warning 1364 Field 'longblob_col' doesn't have a default value
select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1
......@@ -238,7 +232,7 @@ time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
new_blob_col varchar(20) latin1_swedish_ci YES NULL #
tinyblob_col tinyblob NULL YES NULL #
mediumblob_col mediumblob NULL NO NULL #
mediumblob_col mediumblob NULL NO '' #
options enum('one','two','tree') latin1_swedish_ci NO MUL NULL #
flags set('one','two','tree') latin1_swedish_ci NO #
new_field char(10) latin1_swedish_ci NO new #
......@@ -264,7 +258,7 @@ time_field time NULL YES NULL #
date_time datetime NULL YES NULL #
new_blob_col varchar(20) latin1_swedish_ci YES NULL #
tinyblob_col tinyblob NULL YES NULL #
mediumblob_col mediumblob NULL NO NULL #
mediumblob_col mediumblob NULL NO '' #
options enum('one','two','tree') latin1_swedish_ci NO NULL #
flags set('one','two','tree') latin1_swedish_ci NO #
new_field char(10) latin1_swedish_ci NO new #
......
......@@ -273,11 +273,21 @@ a
2011-01-01 01:01:01.12345
drop table t1;
create table t1 (a timestamp(5) default current_timestamp);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a timestamp(5) default current_timestamp());
drop table t1;
create table t1 (a timestamp(5) default current_timestamp(2));
ERROR 42000: Invalid default value for 'a'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a timestamp(5) default current_timestamp(5));
drop table t1;
create table t1 (a timestamp(5) default current_timestamp(6));
......
......@@ -29,7 +29,7 @@ SET @`a b`:=_latin1 X'68656C6C6F' COLLATE `latin1_swedish_ci`/*!*/;
use `test`/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -1134,11 +1134,11 @@ create table t1 (a int);
create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values(1);
insert into v1 values(3);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
insert ignore into v1 values (2),(3),(0);
Warnings:
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1;
a
1
......@@ -1146,20 +1146,20 @@ a
delete from t1;
insert into v1 SELECT 1;
insert into v1 SELECT 3;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
create table t2 (a int);
insert into t2 values (2),(3),(0);
insert ignore into v1 SELECT a from t2;
Warnings:
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1 order by a desc;
a
1
0
update v1 set a=-1 where a=0;
update v1 set a=2 where a=1;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1 order by a desc;
a
1
......@@ -1174,7 +1174,7 @@ a
update v1 set a=a+1;
update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a;
Warnings:
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1;
a
1
......@@ -1188,12 +1188,12 @@ create view v3 as select * from v1 where a > 0 with cascaded check option;
insert into v2 values (1);
insert into v3 values (1);
insert into v2 values (0);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
insert into v3 values (0);
ERROR HY000: CHECK OPTION failed 'test.v3'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v3'
insert into v2 values (2);
insert into v3 values (2);
ERROR HY000: CHECK OPTION failed 'test.v3'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v3'
select * from t1;
a
1
......@@ -1205,10 +1205,10 @@ create table t1 (a int, primary key (a));
create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values (1) on duplicate key update a=2;
insert into v1 values (1) on duplicate key update a=2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
insert ignore into v1 values (1) on duplicate key update a=2;
Warnings:
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1;
a
1
......@@ -1263,7 +1263,7 @@ s1
alter view v2 as select * from t2 where s1 in (select s1 from t1) with check option;
insert into v2 values (5);
update v2 set s1 = 1;
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
insert into t1 values (1);
update v2 set s1 = 1;
select * from v2;
......@@ -1300,16 +1300,16 @@ create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0 with local check option;
create view v2 as select * from v1 with cascaded check option;
insert into v2 values (0);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
drop view v2, v1;
drop table t1;
create table t1 (s1 int);
create view v1 as select * from t1 where s1 < 5 with check option;
insert ignore into v1 values (6);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
insert ignore into v1 values (6),(3);
Warnings:
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1;
s1
3
......@@ -1319,7 +1319,7 @@ create table t1 (s1 tinyint);
create trigger t1_bi before insert on t1 for each row set new.s1 = 500;
create view v1 as select * from t1 where s1 <> 127 with check option;
insert into v1 values (0);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from v1;
s1
select * from t1;
......@@ -1331,7 +1331,7 @@ create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0;
create view v2 as select * from v1 where s1 <> 1 with cascaded check option;
insert into v2 values (0);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
select * from v2;
s1
select * from t1;
......@@ -1341,7 +1341,7 @@ drop table t1;
create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option;
load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1;
a b
1 row 1
......@@ -1356,10 +1356,10 @@ Warnings:
Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1 order by a,b;
a b
1 row 1
......@@ -1375,7 +1375,7 @@ drop table t1;
create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option;
load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
select concat('|',a,'|'), concat('|',b,'|') from v1;
......@@ -1383,7 +1383,7 @@ concat('|',a,'|') concat('|',b,'|')
delete from t1;
load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
Warnings:
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
Warning 1261 Row 2 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
......@@ -3047,9 +3047,9 @@ CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK
INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4);
INSERT INTO v1 (val) VALUES (6);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
UPDATE v1 SET val=6 WHERE id=2;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
DROP VIEW v1;
DROP TABLE t1;
DROP VIEW IF EXISTS v1, v2;
......@@ -3135,7 +3135,7 @@ b
1
2
UPDATE v1 SET b=3;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
SELECT * FROM v1;
b
1
......@@ -3467,14 +3467,14 @@ a1 c
1 0
2 0
UPDATE v1 SET c=3;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
PREPARE t FROM 'UPDATE v1 SET c=3';
EXECUTE t;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
EXECUTE t;
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
INSERT INTO v1(a1, c) VALUES (3, 3);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
UPDATE v1 SET c=1 WHERE a1=1;
SELECT * FROM v1;
a1 c
......@@ -3493,14 +3493,14 @@ a1 c
1 1
2 0
UPDATE v2 SET c=3;
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
PREPARE t FROM 'UPDATE v2 SET c=3';
EXECUTE t;
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
EXECUTE t;
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
INSERT INTO v2(a1, c) VALUES (3, 3);
ERROR HY000: CHECK OPTION failed 'test.v2'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v2'
UPDATE v2 SET c=2 WHERE a1=1;
SELECT * FROM v2;
a1 c
......
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
......@@ -38,7 +38,7 @@ DELIMITER /*!*/;
# at 102
<#>use `test`/*!*/;
SET TIMESTAMP=1196959712/*!*/;
<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=0/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -362,7 +362,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -2268,7 +2268,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
......@@ -3902,7 +3902,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
......@@ -4281,7 +4281,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
......@@ -4867,7 +4867,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
......
......@@ -2268,7 +2268,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
......@@ -3925,7 +3925,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
......@@ -4310,7 +4310,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
......@@ -4906,7 +4906,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
......
......@@ -146,7 +146,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -89,7 +89,7 @@ ROLLBACK/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -342,7 +342,7 @@ ROLLBACK/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -514,7 +514,7 @@ ROLLBACK/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -757,7 +757,7 @@ ROLLBACK/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -1010,7 +1010,7 @@ ROLLBACK/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -1182,7 +1182,7 @@ ROLLBACK/*!*/;
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -19,7 +19,7 @@ BEGIN
/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -50,7 +50,7 @@ use `new_test1`/*!*/;
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -262,7 +262,7 @@ use `new_test1`/*!*/;
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -21,7 +21,7 @@ SET @`v`:=_ucs2 X'006100620063' COLLATE `ucs2_general_ci`/*!*/;
use `test`/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -1019,8 +1019,6 @@ CREATE TABLE federated.t1 (
`blurb` text default '',
PRIMARY KEY (blurb_id))
DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
connection master;
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
......@@ -1030,8 +1028,6 @@ PRIMARY KEY (blurb_id))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
Warnings:
Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. ");
......
......@@ -1838,7 +1838,7 @@ Drop view if exists test.v1 ;
CREATE VIEW test.v1 AS SELECT f59,f60
FROM test.tb2 where f59 = 195 WITH CHECK OPTION ;
--error ER_VIEW_CHECK_FAILED
--error ER_CONSTRAINT_FAILED
UPDATE test.v1 SET f59 = 198 where f59=195 ;
SELECT * FROM test.v1 order by f59 ;
......@@ -1863,7 +1863,7 @@ FROM test.tb2 where F59 = 0987 WITH LOCAL CHECK OPTION ;
CREATE VIEW test.v2 as SELECT * FROM test.v1 ;
# This UPDATE violates the definition of VIEW test.v1.
--error ER_VIEW_CHECK_FAILED
--error ER_CONSTRAINT_FAILED
UPDATE test.v1 SET F59 = 919 where f59 = 0987 ;
SELECT * FROM test.v1 order by f59 ;
......@@ -1909,9 +1909,9 @@ INSERT INTO v1 VALUES('B',2);
SELECT * FROM v1 order by f1, f2;
# negative cases
--enable_info
--error ER_VIEW_CHECK_FAILED
--error ER_CONSTRAINT_FAILED
UPDATE v1 SET f2 = 4;
--error ER_VIEW_CHECK_FAILED
--error ER_CONSTRAINT_FAILED
INSERT INTO v1 VALUES('B',3);
--disable_info
# Bug#11771: View over InnoDB table, wrong result SELECT on VIEW,
......@@ -2292,7 +2292,7 @@ WHERE v3_to_v1_options LIKE 'WITH %' AND v3_to_v1_options NOT LIKE 'WITH LOCAL %
AND v3_to_v1_violation NOT LIKE ' _ _ ' AND errno = 0
ORDER BY v3_to_v1_options;
# 5. There must be NO failing INSERT/UPDATE getting a
# sql_errno <> 1369 (ER_VIEW_CHECK_FAILED).
# sql_errno <> 1369 (ER_CONSTRAINT_FAILED).
SELECT * FROM t1_results
WHERE errno <> 0 AND errno <> 1369
ORDER BY v3_to_v1_options;
......
......@@ -544,9 +544,9 @@ t2 CREATE TABLE `t2` (
delete from t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
drop index dc on t4;
ERROR 42000: Can't DROP 'dc'; check that column/key exists
ERROR 42000: Can't DROP 'dc'; check that constraint/column/key exists
alter table t3 drop foreign key dc;
ERROR 42000: Can't DROP 'dc'; check that column/key exists
ERROR 42000: Can't DROP 'dc'; check that constraint/column/key exists
alter table t4 drop foreign key dc;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
......
......@@ -162,50 +162,42 @@ grad_degree CREATE TABLE `grad_degree` (
`plan` varchar(10) NOT NULL,
`admit_term` char(4) NOT NULL,
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
`ofis_deg_status` varchar(15) AS (
CASE
`ofis_deg_status` varchar(15) AS (CASE
WHEN wdraw_rsn = '' THEN 'In progress'
WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed'
ELSE 'Not Completed'
END) VIRTUAL,
`ofis_deg_status2` varchar(15) AS (
CASE
`ofis_deg_status2` varchar(15) AS (CASE
WHEN wdraw_rsn = '' THEN 'In progress2'
WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2'
ELSE 'Not Completed2'
END) VIRTUAL,
`ofis_deg_status3` varchar(15) AS (
CASE
`ofis_deg_status3` varchar(15) AS (CASE
WHEN wdraw_rsn = '' THEN 'In progress3'
WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3'
ELSE 'Not Completed3'
END) VIRTUAL,
`ofis_deg_status4` varchar(15) AS (
CASE
`ofis_deg_status4` varchar(15) AS (CASE
WHEN wdraw_rsn = '' THEN 'In progress4'
WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4'
ELSE 'Not Completed4'
END) VIRTUAL,
`ofis_deg_status5` varchar(15) AS (
CASE
`ofis_deg_status5` varchar(15) AS (CASE
WHEN wdraw_rsn = '' THEN 'In progress5'
WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5'
ELSE 'Not Completed5'
END) VIRTUAL,
`ofis_deg_status6` varchar(15) AS (
CASE
`ofis_deg_status6` varchar(15) AS (CASE
WHEN wdraw_rsn = '' THEN 'In progress6'
WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6'
ELSE 'Not Completed6'
END) VIRTUAL,
`ofis_deg_status7` varchar(15) AS (
CASE
`ofis_deg_status7` varchar(15) AS (CASE
WHEN wdraw_rsn = '' THEN 'In progress7'
WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7'
ELSE 'Not Completed7'
END) VIRTUAL,
`ofis_deg_status8` varchar(15) AS (
CASE
`ofis_deg_status8` varchar(15) AS (CASE
WHEN wdraw_rsn = '' THEN 'In progress8'
WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8'
ELSE 'Not Completed8'
......
......@@ -8,8 +8,6 @@ KEY kt(tag),
KEY kv(value(15)),
FULLTEXT KEY kvf(value)
) ENGINE = InnoDB;
Warnings:
Warning 1101 BLOB/TEXT column 'value' can't have a default value
CREATE TABLE t2 (
id_t2 mediumint unsigned NOT NULL default '0',
id_t1 mediumint unsigned NOT NULL default '0',
......
......@@ -9,8 +9,6 @@ name VARCHAR(80) DEFAULT '' NOT NULL,
FULLTEXT(url,description,shortdesc,longdesc),
PRIMARY KEY(gnr)
) ENGINE = InnoDB;
Warnings:
Warning 1101 BLOB/TEXT column 'longdesc' can't have a default value
insert into test (url,shortdesc,longdesc,description,name) VALUES
("http:/test.at", "kurz", "lang","desc", "name");
insert into test (url,shortdesc,longdesc,description,name) VALUES
......
......@@ -805,8 +805,6 @@ INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) row_format=dynamic DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
......@@ -823,8 +821,6 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) row_format=dynamic DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
......@@ -839,8 +835,6 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) row_format=dynamic DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
......
......@@ -805,8 +805,6 @@ INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) transactional=1 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
......@@ -823,8 +821,6 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) transactional=1 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
......@@ -839,8 +835,6 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) transactional=1 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
......
......@@ -805,8 +805,6 @@ INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) transactional=0 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
......@@ -823,8 +821,6 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) transactional=0 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
......@@ -839,8 +835,6 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) transactional=0 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
......
# Include file to to test failure with error injection.
# Include file to test failure with error injection.
# To be used with WL#4445: EXCHANGE PARTITION WITH TABLE.
--eval $create_statement2
--eval $insert_statement2
......
include/master-slave.inc
[connection master]
connection master;
create table t1 (a int DEFAULT 1+1, b bigint default uuid_short(), u blob default user());
insert into t1 (a) values(1);
connection slave;
connection slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT 1+1,
`b` bigint(20) DEFAULT uuid_short(),
`u` blob DEFAULT user()
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a uuid user
1 1 1
connection master;
drop table t1;
include/rpl_end.inc
......@@ -643,7 +643,7 @@ c1 c3 hex(c4) c5 c6
************
connection slave;
include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that constraint/column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE;
RESET SLAVE;
......
......@@ -643,7 +643,7 @@ c1 c3 hex(c4) c5 c6
************
connection slave;
include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
Last_SQL_Error = 'Error 'Can't DROP 'c7'; check that constraint/column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE;
RESET SLAVE;
......
......@@ -37,7 +37,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1293832861/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -179,7 +179,7 @@ ROLLBACK/*!*/;
use `db1``; select 'oops!'`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -279,7 +279,7 @@ ROLLBACK/*!*/;
use `db1``; select 'oops!'`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -388,7 +388,7 @@ BEGIN
use `ts``et`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -167,7 +167,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -191,7 +191,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -312,7 +312,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......@@ -345,7 +345,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
......@@ -783,7 +783,7 @@ DELIMITER /*!*/;
ROLLBACK/*!*/;
SET TIMESTAMP=t/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
......
#
# Test of replicating default values
# As the table is using non deterministic functions, replication must
# switch to binlog format.
#
-- source include/have_binlog_format_mixed_or_row.inc
-- source include/master-slave.inc
connection master;
create table t1 (a int DEFAULT 1+1, b bigint default uuid_short(), u blob default user());
insert into t1 (a) values(1);
let $b=query_get_value(select * from t1, b, 1);
let $u=query_get_value(select * from t1, u, 1);
sync_slave_with_master;
connection slave;
show create table t1;
--disable_query_log
eval select a,"$b"=b as uuid,"$u"=u as user from t1;
--enable_query_log
connection master;
drop table t1;
--source include/rpl_end.inc
......@@ -387,6 +387,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME CHECK_CONSTRAINT_CHECKS
SESSION_VALUE ON
GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE ON
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT check_constraint_checks
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME COLLATION_CONNECTION
SESSION_VALUE latin1_swedish_ci
GLOBAL_VALUE latin1_swedish_ci
......
......@@ -387,6 +387,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME CHECK_CONSTRAINT_CHECKS
SESSION_VALUE ON
GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE ON
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT check_constraint_checks
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME COLLATION_CONNECTION
SESSION_VALUE latin1_swedish_ci
GLOBAL_VALUE latin1_swedish_ci
......
......@@ -34,6 +34,7 @@ PARTITION BY RANGE( b ) (
insert into t1 values ('2006-01-01',default);
insert into t1 values ('2007-01-01',default);
insert into t1 values ('2005-01-01',default);
insert into t1 (a) values ('2007-01-02');
select * from t1;
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
......
......@@ -4,32 +4,28 @@ set time_zone='+10:00';
set div_precision_increment=20;
create table t1 (a int, b int, v decimal(20,19) as (a/3));
create table t2 (a int, b int, v int as (a+@a));
ERROR HY000: Function or expression is not allowed for column 'v'
create table t3 (a int, b int, v int as (a+@@error_count));
ERROR HY000: Function or expression is not allowed for column 'v'
ERROR HY000: Function or expression 'user_var' is not allowed for 'VIRTUAL' of column/constraint 'v'
create table t2 (a int, b int, v int as (a+@a) PERSISTENT);
ERROR HY000: Function or expression 'user_var' is not allowed for 'VIRTUAL' of column/constraint 'v'
create table t3_ok (a int, b int, v int as (a+@@error_count));
create table t3 (a int, b int, v int as (a+@@error_count) PERSISTENT);
ERROR HY000: Function or expression 'get_system_var' is not allowed for 'VIRTUAL' of column/constraint 'v'
create table t4 (a int, b int, v int as (@a:=a));
ERROR HY000: Function or expression is not allowed for column 'v'
ERROR HY000: Function or expression 'user_var' is not allowed for 'VIRTUAL' of column/constraint 'v'
create table t4 (a int, b int, v int as (@a:=a) PERSISTENT);
ERROR HY000: Function or expression 'user_var' is not allowed for 'VIRTUAL' of column/constraint 'v'
create table t5 (a int, b int, v varchar(100) as (monthname(a)));
ERROR HY000: Function or expression 'monthname' is not allowed for 'VIRTUAL' of column/constraint 'v'
create table t6 (a int, b int, v varchar(100) as (dayname(a)));
ERROR HY000: Function or expression 'dayname' is not allowed for 'VIRTUAL' of column/constraint 'v'
create table t7 (a int, b int, v varchar(100) as (date_format(a, '%W %a %M %b')));
ERROR HY000: Function or expression 'date_format' is not allowed for 'VIRTUAL' of column/constraint 'v'
create table t8 (a int, b int, v varchar(100) as (from_unixtime(a)));
insert t1 (a,b) values (1,2);
insert t5 (a,b) values (20141010,2);
insert t6 (a,b) values (20141010,2);
insert t7 (a,b) values (20141010,2);
insert t8 (a,b) values (1234567890,2);
select * from t1;
a b v
1 2 0.3333333333333333333
select * from t5;
a b v
20141010 2 octubre
select * from t6;
a b v
20141010 2 viernes
select * from t7;
a b v
20141010 2 viernes vie octubre oct
select * from t8;
a b v
1234567890 2 2009-02-14 09:31:30
......@@ -39,15 +35,6 @@ set time_zone='+1:00';
select * from t1;
a b v
1 2 0.3333333333333333333
select * from t5;
a b v
20141010 2 octubre
select * from t6;
a b v
20141010 2 viernes
select * from t7;
a b v
20141010 2 viernes vie octubre oct
select * from t8;
a b v
1234567890 2 2009-02-14 09:31:30
......@@ -55,16 +42,7 @@ flush tables;
select * from t1;
a b v
1 2 0.3333333330000000000
select * from t5;
a b v
20141010 2 October
select * from t6;
a b v
20141010 2 Friday
select * from t7;
a b v
20141010 2 Friday Fri October Oct
select * from t8;
a b v
1234567890 2 2009-02-14 00:31:30
drop table t1, t5, t6, t7, t8;
drop table t1, t3_ok, t8;
This diff is collapsed.
......@@ -34,7 +34,7 @@ CREATE TABLE t1 (
a int NOT NULL DEFAULT '0',
v double AS ((1, a)) VIRTUAL
);
ERROR HY000: Expression for computed column cannot return a row
ERROR 21000: Operand should contain 1 column(s)
CREATE TABLE t1 (
a CHAR(255) BINARY NOT NULL DEFAULT 0,
b CHAR(255) BINARY NOT NULL DEFAULT 0,
......@@ -187,11 +187,7 @@ ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL
) ENGINE=MyISAM;
INSERT INTO t1 (tsv) VALUES (DEFAULT);
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT);
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
FLUSH TABLES;
SELECT COUNT(*) FROM t1;
COUNT(*)
......@@ -320,7 +316,9 @@ drop table t1;
# MDEV-5611: self-referencing virtual column
#
create table t1 (a int, b int as (b is null) virtual);
ERROR HY000: A computed column cannot be based on a computed column
ERROR 01000: Expression for field `b` is refering to uninitialized field `b`
create table t1 (a int as (1+1), b int as (a is null) virtual);
drop table t1;
# end of 5.3 tests
create table t1 (v1 varchar(255) as (c1) persistent, c1 varchar(50)) collate=latin1_general_ci;
show create table t1;
......
......@@ -12,15 +12,17 @@ PARTITION p2 VALUES LESS THAN (2008)
insert into t1 values ('2006-01-01',default);
insert into t1 values ('2007-01-01',default);
insert into t1 values ('2005-01-01',default);
insert into t1 (a) values ('2007-01-02');
select * from t1;
a b
2005-01-01 2005
2006-01-01 2006
2007-01-01 2007
2007-01-02 2007
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p0 1 16384
p2 2 16384
p2 3 16384
# Modify the expression of virtual column b
ALTER TABLE t1 modify b int as (year(a)-1);
select * from t1;
......@@ -28,10 +30,11 @@ a b
2005-01-01 2004
2006-01-01 2005
2007-01-01 2006
2007-01-02 2006
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p0 2 16384
p2 1 16384
p2 2 16384
drop table t1;
# Case 2. Partitioning by LIST based on a stored virtual column.
CREATE TABLE t1 (a int, b int as (a % 3 ) persistent)
......
......@@ -12,15 +12,17 @@ PARTITION p2 VALUES LESS THAN (2008)
insert into t1 values ('2006-01-01',default);
insert into t1 values ('2007-01-01',default);
insert into t1 values ('2005-01-01',default);
insert into t1 (a) values ('2007-01-02');
select * from t1;
a b
2005-01-01 2005
2006-01-01 2006
2007-01-01 2007
2007-01-02 2007
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p0 1 7
p2 2 14
p2 3 21
# Modify the expression of virtual column b
ALTER TABLE t1 modify b int as (year(a)-1);
select * from t1;
......@@ -28,10 +30,11 @@ a b
2005-01-01 2004
2006-01-01 2005
2007-01-01 2006
2007-01-02 2006
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p0 2 14
p2 1 7
p2 2 14
drop table t1;
# Case 2. Partitioning by LIST based on a stored virtual column.
CREATE TABLE t1 (a int, b int as (a % 3 ) persistent)
......
......@@ -270,11 +270,11 @@ c int as (-a) persistent);
create view v1 as select * from t1 where b > -2 && c >-2 with check option;
insert into v1 (a) values (1);
insert into v1 (a) values (3);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
insert ignore into v1 (a) values (2),(3),(0);
Warnings:
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1;
a b c
1 -1 -1
......
......@@ -270,11 +270,11 @@ c int as (-a) persistent);
create view v1 as select * from t1 where b > -2 && c >-2 with check option;
insert into v1 (a) values (1);
insert into v1 (a) values (3);
ERROR HY000: CHECK OPTION failed 'test.v1'
ERROR HY000: CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
insert ignore into v1 (a) values (2),(3),(0);
Warnings:
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
Warning 1369 CONSTRAINT 'WITH CHECK OPTION' failed for 'test.v1'
select * from t1;
a b c
1 -1 -1
......
This diff is collapsed.
......@@ -39,7 +39,7 @@ eval SET @@session.storage_engine = 'MyISAM';
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/vcol/inc/vcol_blocked_sql_funcs_main.inc
--source vcol_blocked_sql_funcs_main.inc
#------------------------------------------------------------------------------#
# Execute storage engine specific tests
......
......@@ -26,7 +26,7 @@ drop table t1;
# Bug#604549: Expression for virtual column returns row
#
-- error ER_ROW_EXPR_FOR_VCOL
-- error ER_OPERAND_COLUMNS
CREATE TABLE t1 (
a int NOT NULL DEFAULT '0',
v double AS ((1, a)) VIRTUAL
......@@ -279,9 +279,12 @@ drop table t1;
--echo # MDEV-5611: self-referencing virtual column
--echo #
--error ER_VCOL_BASED_ON_VCOL
--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create table t1 (a int, b int as (b is null) virtual);
create table t1 (a int as (1+1), b int as (a is null) virtual);
drop table t1;
--echo # end of 5.3 tests
#
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment