Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
11.7.2
-
Rocky Linux 9.5 x86_64
-
Can result in unexpected behaviour
-
Q3/2025 Maintenance
Description
when I set the database variables innodb_force_primary_key=on ,create vetor table with not vector index succeed,but with vector index will failed because of table struct ? and table struct file can not be found in table's data path,but table's data file can be found. when I set innodb_force_primary_key=off, the problem can be solved .
1) innodb_force_primary_key=on
MariaDB [tt]> use tt
|
Database changed
|
MariaDB [tt]> CREATE TABLE v (
|
-> id INT PRIMARY KEY,
|
-> v VECTOR(5) NOT NULL,
|
-> VECTOR INDEX (v)
|
-> );
|
ERROR 1939 (HY000): Engine InnoDB failed to discover table `tt`.`v` with 'CREATE TABLE i ( layer tinyint not null, tref varbinary(4), vec blob not null, neighbors blob not null, unique (tref), key (layer)) '
|
MariaDB [tt]> drop table v;
|
Query OK, 0 rows affected (0.006 sec)
|
|
MariaDB [tt]> exit
|
2) innodb_force_primary_key=off
MariaDB [tt]> CREATE TABLE products ( name varchar(128), description varchar(2000), embedding VECTOR(4) NOT NULL, VECTOR INDEX (embedding) M=6 DISTANCE=euclidean) ENGINE=InnoDB;
|
ERROR 1173 (42000): This table type requires a primary key
|
MariaDB [tt]> set global '%primary%';
|
ERROR 1064 (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 ''%primary%'' at line 1
|
MariaDB [tt]> set global '%p^Cma%';
|
MariaDB [tt]> show variables like '%primary%';
|
+--------------------------+-------+
|
| Variable_name | Value |
|
+--------------------------+-------+
|
| innodb_force_primary_key | ON |
|
+--------------------------+-------+
|
1 row in set (0.003 sec)
|
|
MariaDB [tt]> set innodb_force_primary_key=off;
|
ERROR 1229 (HY000): Variable 'innodb_force_primary_key' is a GLOBAL variable and should be set with SET GLOBAL
|
MariaDB [tt]> set global innodb_force_primary_key=off;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [tt]> CREATE TABLE products ( name varchar(128), description varchar(2000), embedding VECTOR(4) NOT NULL, VECTOR INDEX (embedding) M=6 DISTANCE=euclidean) ENGINE=InnoDB;
|
Query OK, 0 rows affected (0.010 sec)
|
|
MariaDB [tt]> CREATE TABLE embeddings ( doc_id BIGINT UNSIGNED PRIMARY KEY, embedding VECTOR(1536) NOT NULL, VECTOR INDEX (embedding) M=8 DISTANCE=cosine );
|
Query OK, 0 rows affected (0.010 sec)
|
|
MariaDB [tt]> show tables;
|
+--------------+
|
| Tables_in_tt |
|
+--------------+
|
| embeddings |
|
| products |
|
| test |
|
| tt |
|
+--------------+
|
4 rows in set (0.000 sec)
|
|
MariaDB [tt]> CREATE TABLE doc_vectors( doc_id INT PRIMARY KEY, metadata VARCHAR(4000), content TEXT, embedding VECTOR(1024) NOT NULL, VECTOR INDEX (embedding) M=8 DISTANCE=cosine );
|
Query OK, 0 rows affected (0.011 sec)
|
Attachments
Issue Links
- relates to
-
MDEV-36005 Server crashes when checking/updatng a table having vector key after enabling innodb_force_primary_key
-
- Closed
-