mirror of
https://github.com/MariaDB/server.git
synced 2025-02-22 13:23:07 +01:00
119 lines
4.6 KiB
Text
119 lines
4.6 KiB
Text
#
|
|
# mysqldump
|
|
#
|
|
create table t1 (id int auto_increment primary key, v vector(5) not null);
|
|
insert t1 (v) values (Vec_Fromtext('[0.418,0.809,0.823,0.598,0.033]')),
|
|
(Vec_Fromtext('[0.186,0.696,0.035,0.668,0.847]')),
|
|
(Vec_Fromtext('[0.415,0.609,0.426,0.988,0.475]'));
|
|
select id from t1 order by vec_distance_euclidean(v, Vec_FromText('[1,0,0,0,0]')) limit 3;
|
|
id
|
|
1
|
|
3
|
|
2
|
|
/*M!999999\- enable the sandbox mode */
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `t1` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`v` vector(5) NOT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
set autocommit=0;
|
|
INSERT INTO `t1` VALUES
|
|
(1,0x1904D63EA01A4F3F21B0523F8716193F022B073D),
|
|
(2,0xC9763E3E0E2D323F295C0F3D0C022B3FFED4583F),
|
|
(3,0xE17AD43E6DE71B3FAC1CDA3E91ED7C3F3333F33E);
|
|
commit;
|
|
<?xml version="1.0"?>
|
|
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
<database name="test">
|
|
<table_structure name="t1">
|
|
<field Field="id" Type="int(11)" Null="NO" Key="PRI" Extra="auto_increment" Comment="" />
|
|
<field Field="v" Type="vector(5)" Null="NO" Key="" Extra="" Comment="" />
|
|
<key Table="t1" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="3" Null="" Index_type="BTREE" Comment="" Index_comment="" Ignored="NO" />
|
|
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="32" Data_length="96" Max_data_length="281474976710655" Index_length="2048" Data_free="0" Auto_increment="4" Create_time="YYYY-MM-DD hh:mm:ss" Update_time="YYYY-MM-DD hh:mm:ss" Collation="utf8mb4_uca1400_ai_ci" Create_options="" Comment="" Max_index_length="288230376151710720" Temporary="N" />
|
|
</table_structure>
|
|
<table_data name="t1">
|
|
<row>
|
|
<field name="id">1</field>
|
|
<field name="v" xsi:type="xs:hexBinary">1904D63EA01A4F3F21B0523F8716193F022B073D</field>
|
|
</row>
|
|
<row>
|
|
<field name="id">2</field>
|
|
<field name="v" xsi:type="xs:hexBinary">C9763E3E0E2D323F295C0F3D0C022B3FFED4583F</field>
|
|
</row>
|
|
<row>
|
|
<field name="id">3</field>
|
|
<field name="v" xsi:type="xs:hexBinary">E17AD43E6DE71B3FAC1CDA3E91ED7C3F3333F33E</field>
|
|
</row>
|
|
</table_data>
|
|
</database>
|
|
</mysqldump>
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`v` vector(5) NOT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
|
select id, Vec_ToText(v) from t1;
|
|
id Vec_ToText(v)
|
|
1 [0.418,0.809,0.823,0.598,0.033]
|
|
2 [0.186,0.696,0.035,0.668,0.847]
|
|
3 [0.415,0.609,0.426,0.988,0.475]
|
|
select id from t1 order by vec_distance_euclidean(v, Vec_FromText('[1,0,0,0,0]')) limit 3;
|
|
id
|
|
1
|
|
3
|
|
2
|
|
drop table t1;
|
|
#
|
|
# MDEV-35044 ALTER on a table with vector index attempts to bypass unsupported locking limitation, server crashes in THD::free_tmp_table_share
|
|
#
|
|
create table t (a int primary key, v vector(10) not null, vector index(v));
|
|
alter table t modify a int auto_increment, lock=none;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: CHANGE COLUMN ... AUTO_INCREMENT. Try LOCK=SHARED
|
|
drop table t;
|
|
#
|
|
# MDEV-35061 XA PREPARE "not supported by the engine" from storage engine mhnsw, memory leak
|
|
#
|
|
create table t1 (v vector(1) not null, vector(v)) engine=innodb;
|
|
insert into t1 select 0x00000000 as v from seq_1_to_1000;
|
|
connect con1,localhost,root;
|
|
alter table t1 add column x int, algorithm=copy;;
|
|
connection default;
|
|
xa start 'x';
|
|
select * from non_existing_table;
|
|
ERROR 42S02: Table 'test.non_existing_table' doesn't exist
|
|
delete from t1;
|
|
xa end 'x';
|
|
xa prepare 'x';
|
|
ERROR HY000: Got error 138 "Unsupported extension used for table" from storage engine mhnsw
|
|
connection con1;
|
|
disconnect con1;
|
|
connection default;
|
|
drop table t1;
|
|
#
|
|
# MDEV-35223 REPAIR does not fix MyISAM table with vector key after crash recovery
|
|
#
|
|
call mtr.add_suppression('t#i#00'' is marked as crashed and should be repaired');
|
|
create table t (v vector(1) not null, vector(v)) engine=myisam;
|
|
insert into t (v) values (0x30303030),(0x31313131);
|
|
# restart
|
|
check table t extended;
|
|
Table Op Msg_type Msg_text
|
|
test.t check warning 1 client is using or hasn't closed the table properly
|
|
test.t check Error Table './test/t#i#00' is marked as crashed and should be repaired
|
|
test.t check status Operation failed
|
|
repair table t extended;
|
|
Table Op Msg_type Msg_text
|
|
test.t repair note Table does not support optimize, doing recreate + analyze instead
|
|
test.t repair status OK
|
|
check table t extended;
|
|
Table Op Msg_type Msg_text
|
|
test.t check status OK
|
|
select v from t order by vec_distance_euclidean(0x323233232,v) limit 1;
|
|
v
|
|
0000
|
|
drop table t;
|