【问题描述】:
把服务从mysql迁移到TiDB后部分语句执行报错,异常语句简化后如下:
SELECT *
FROM review_tbl AS Review
ORDER BY
(
Review.creator_id = 2
AND EXISTS (
SELECT
1
FROM
review_auditor_tbl
WHERE
review_id = Review.id
)
) DESC
LIMIT 0,
30;
CREATE TABLE review_tbl ( id int(11) NOT NULL AUTO_INCREMENT, no int(11) NOT NULL, repository_id int(11) NOT NULL, title varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, description varchar(3000) COLLATE utf8mb4_unicode_ci NOT NULL, status int(11) NOT NULL, creator_id int(11) NOT NULL, create_time datetime NOT NULL, update_time datetime NOT NULL, close_time datetime DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=60093
CREATE TABLE review_auditor_tbl ( id int(11) NOT NULL AUTO_INCREMENT, review_id int(11) NOT NULL, user_id int(11) NOT NULL, status int(11) NOT NULL, is_delete tinyint(1) NOT NULL, creator_id int(11) NOT NULL, create_time datetime NOT NULL, update_time datetime NOT NULL,
PRIMARY KEY (id),
KEY idx_reviewid_isdelete_userid_status (review_id,is_delete,user_id,status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=30146