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

Đang mở Phù hợp với người mới
#33,362 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, mysql
Lĩnh vực
databases

Hướng nghiên cứu

Bắt đầu từ các trình xây dựng chỉ mục trong build_ddl.go và so sánh cách chúng xử lý cột không tồn tại với cách sử dụng hiện có của moerr.NewErrKeyColumnDoesNotExist cho ALTER TABLE ADD PRIMARY KEY. Tái hiện lỗi bằng một trong các câu lệnh SQL trong issue, sau đó kiểm tra xem các trường hợp chỉ mục thông thường có trả về lỗi 1072 với SQLSTATE 42000 hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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 智能体执行。

Ngôn ngữ chính
Go
Star
1.9k
Fork
312
Merge trung bình
21 giờ 57 phút
Pull request đã merge (30 ngày)
730

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của matrixorigin/matrixone

Tất cả issue của matrixorigin/matrixone

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.