mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
db7edfed17
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
43 lines
1.2 KiB
Text
43 lines
1.2 KiB
Text
DROP TABLE IF EXISTS t1, t2;
|
|
CREATE TABLE t1 (
|
|
id mediumint unsigned NOT NULL auto_increment,
|
|
tag char(6) NOT NULL default '',
|
|
value text NOT NULL default '',
|
|
PRIMARY KEY (id),
|
|
KEY kt(tag),
|
|
KEY kv(value(15)),
|
|
FULLTEXT KEY kvf(value)
|
|
) ENGINE=MyISAM;
|
|
CREATE TABLE t2 (
|
|
id_t2 mediumint unsigned NOT NULL default '0',
|
|
id_t1 mediumint unsigned NOT NULL default '0',
|
|
field_number tinyint unsigned NOT NULL default '0',
|
|
PRIMARY KEY (id_t2,id_t1,field_number),
|
|
KEY id_t1(id_t1)
|
|
) ENGINE=MyISAM;
|
|
INSERT INTO t1 (tag,value) VALUES ('foo123','bar111');
|
|
INSERT INTO t1 (tag,value) VALUES ('foo123','bar222');
|
|
INSERT INTO t1 (tag,value) VALUES ('bar345','baz333 ar');
|
|
INSERT INTO t2 VALUES (2231626,64280,0);
|
|
INSERT INTO t2 VALUES (2231626,64281,0);
|
|
INSERT INTO t2 VALUES (12346, 3, 1);
|
|
SELECT * FROM t1;
|
|
id tag value
|
|
1 foo123 bar111
|
|
2 foo123 bar222
|
|
3 bar345 baz333 ar
|
|
SELECT * FROM t2;
|
|
id_t2 id_t1 field_number
|
|
12346 3 1
|
|
2231626 64280 0
|
|
2231626 64281 0
|
|
SELECT DISTINCT t2.id_t2 FROM t2, t1
|
|
WHERE MATCH (t1.value) AGAINST ('baz333') AND t1.id = t2.id_t1;
|
|
id_t2
|
|
12346
|
|
SELECT DISTINCT t2.id_t2 FROM t2, t1
|
|
WHERE MATCH (t1.value) AGAINST ('baz333' IN BOOLEAN MODE)
|
|
AND t1.id = t2.id_t1;
|
|
id_t2
|
|
12346
|
|
DROP TABLE t1, t2;
|