[Bug]: index on a missing column returns 20301 'column is not exist' instead of ER_KEY_COLUMN_DOES_NOT_EXIST 1072

Abierto Apto para principiantes
#33,362 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
74/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, mysql
Área
databases

Línea de trabajo

Empieza por los constructores de índices en build_ddl.go y compara cómo gestionan las columnas inexistentes con el uso existente de moerr.NewErrKeyColumnDoesNotExist para ALTER TABLE ADD PRIMARY KEY. Reprodúcelo con una de las sentencias SQL del issue y comprueba después que los casos habituales de índices devuelven el error 1072 con SQLSTATE 42000.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

kind/bug
Is there an existing issue for the same bug?
  • I have checked the existing issues (searched is not exist, Key column, 1072).
Branch Name

main (9bf005bf)

Describe the bug

When a regular index (KEY / INDEX / UNIQUE, in CREATE TABLE, CREATE [UNIQUE] INDEX or ALTER TABLE ADD INDEX) names a column the table does not have, MO returns the generic error 20301 invalid input: column 'x' is not exist. MySQL returns ER_KEY_COLUMN_DOES_NOT_EXIST (1072, SQLSTATE 42000) Key column 'x' doesn't exist in table. Migration tools and ORMs that match on the error number cannot recognize the MO error.

MO already has moerr.NewErrKeyColumnDoesNotExist (used by ALTER TABLE ADD PRIMARY KEY). The index builders in build_ddl.go (unique, secondary, fulltext-type and spatial checks) still use NewInvalidInputf("column '%s' is not exist").

Steps to reproduce
CREATE TABLE t4 (a INT, b INT, KEY (c));
CREATE TABLE t5 (a INT PRIMARY KEY, UNIQUE KEY uk (col10));
CREATE TABLE t6 (col1 INT, col2 CHAR(15));
CREATE UNIQUE INDEX m3 ON t6 (col3);
Expected behavior (MySQL 8.4)
ERROR 1072 (42000): Key column 'c' doesn't exist in table
ERROR 1072 (42000): Key column 'col10' doesn't exist in table
ERROR 1072 (42000): Key column 'col3' doesn't exist in table
Actual behavior (MatrixOne main 9bf005bf)
ERROR 20301: invalid input: column 'c' is not exist
ERROR 20301: invalid input: column 'col10' is not exist
ERROR 20301: invalid input: column 'col3' is not exist
Additional information

Single-node mo-service -launch etc/launch/launch.toml. Vector index plugins (IVFFLAT/HNSW/…) are MO-specific and out of scope.

本操作由 LW 授权的 Grok Bot 智能体执行。

Lenguaje dominante
Go
Estrellas
1.9k
Forks
312
Merge medio
22 h 59 min
PR fusionados (30 d)
736

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de matrixorigin/matrixone

Todos los issues de matrixorigin/matrixone

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.