mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-35922 Server crashes in mhnsw_read_first upon using vector key with views
This commit is contained in:
@@ -273,4 +273,16 @@ drop table t;
|
||||
create table t (v vector (1) not null,vector index (v)) engine=innodb;
|
||||
ERROR 42000: This table type requires a primary key
|
||||
set global innodb_force_primary_key=0;
|
||||
#
|
||||
# MDEV-35922 Server crashes in mhnsw_read_first upon using vector key with views
|
||||
#
|
||||
create table t (pk int primary key, v vector(1) not null, vector(v)) engine=innodb;
|
||||
insert into t values (1,0x31313131),(2,0x32323232);
|
||||
create view v as select * from t;
|
||||
select pk from v order by vec_distance_euclidean(v, 0x30303030) limit 2;
|
||||
pk
|
||||
1
|
||||
2
|
||||
drop view v;
|
||||
drop table t;
|
||||
# End of 11.7 tests
|
||||
|
@@ -274,4 +274,15 @@ drop table t;
|
||||
--error ER_REQUIRES_PRIMARY_KEY
|
||||
create table t (v vector (1) not null,vector index (v)) engine=innodb;
|
||||
set global innodb_force_primary_key=0;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35922 Server crashes in mhnsw_read_first upon using vector key with views
|
||||
--echo #
|
||||
create table t (pk int primary key, v vector(1) not null, vector(v)) engine=innodb;
|
||||
insert into t values (1,0x31313131),(2,0x32323232);
|
||||
create view v as select * from t;
|
||||
select pk from v order by vec_distance_euclidean(v, 0x30303030) limit 2;
|
||||
drop view v;
|
||||
drop table t;
|
||||
|
||||
--echo # End of 11.7 tests
|
||||
|
@@ -49,9 +49,9 @@ public:
|
||||
double val_real() override;
|
||||
Item *get_const_arg() const
|
||||
{
|
||||
if (args[0]->type() == Item::FIELD_ITEM && args[1]->const_item())
|
||||
if (args[0]->real_item()->type() == Item::FIELD_ITEM && args[1]->const_item())
|
||||
return args[1];
|
||||
if (args[1]->type() == Item::FIELD_ITEM && args[0]->const_item())
|
||||
if (args[1]->real_item()->type() == Item::FIELD_ITEM && args[0]->const_item())
|
||||
return args[0];
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user