-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-4.0This bug affects 4.0.x versions.This bug affects 4.0.x versions.affects-5.0This bug affects 5.0.x versions.This bug affects 5.0.x versions.affects-5.1This bug affects 5.1.x versions.This bug affects 5.1.x versions.affects-5.2This bug affects 5.2.x versions.This bug affects 5.2.x versions.affects-5.3This bug affects 5.3.x versions.This bug affects 5.3.x versions.affects-5.4This bug affects the 5.4.x(LTS) versions.This bug affects the 5.4.x(LTS) versions.affects-6.0affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.2affects-6.3affects-6.4affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.report/communityThe community has encountered this bug.The community has encountered this bug.severity/moderatesig/sql-infraSIG: SQL InfraSIG: SQL Infratype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.type/compatibility
Description
This happens only if that multi-statement query is inside a transaction (which is how diesel runs migrations).
Here is the minimal reproduction:
mariadb --host=127.0.0.1 --port=4000 --user=root --database test --delimiter ';;;' --execute "$(cat << EOF
-- First migration creates the table foo
BEGIN;
;;;
CREATE TABLE foo(pk CHAR(1) PRIMARY KEY);
;;;
COMMIT;
-- Second migration renames foo, creates a new foo,
-- and selects into the new foo from the old foo
;;;
BEGIN;
;;;
ALTER TABLE foo RENAME TO bar;
CREATE TABLE foo(pk CHAR(1) PRIMARY KEY);
INSERT INTO foo (pk) SELECT pk FROM bar;
;;;
COMMIT;
;;;
EOF
)"
Tested against a new instance run by tiup:
*************************** 1. row ***************************
tidb_version(): Release Version: v6.4.0
Edition: Community
Git Commit Hash: cf36a9ce2fe1039db3cf3444d51930b887df18a1
Git Branch: heads/refs/tags/v6.4.0
UTC Build Time: 2022-11-13 05:25:30
GoVersion: go1.19.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
Originally posted by @Pythoner6 in #24194 (comment)
Metadata
Metadata
Assignees
Labels
affects-4.0This bug affects 4.0.x versions.This bug affects 4.0.x versions.affects-5.0This bug affects 5.0.x versions.This bug affects 5.0.x versions.affects-5.1This bug affects 5.1.x versions.This bug affects 5.1.x versions.affects-5.2This bug affects 5.2.x versions.This bug affects 5.2.x versions.affects-5.3This bug affects 5.3.x versions.This bug affects 5.3.x versions.affects-5.4This bug affects the 5.4.x(LTS) versions.This bug affects the 5.4.x(LTS) versions.affects-6.0affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.2affects-6.3affects-6.4affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.report/communityThe community has encountered this bug.The community has encountered this bug.severity/moderatesig/sql-infraSIG: SQL InfraSIG: SQL Infratype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.type/compatibility