Open dveeden opened 3 years ago
Note that PostgreSQL also has the AND CHAIN
, but limits this to transaction blocks.
test=# \echo :AUTOCOMMIT
on
test=# CREATE TABLE t1 (id SERIAL);
CREATE TABLE
test=# INSERT INTO t1 VALUES(1);
INSERT 0 1
test=# ROLLBACK;
WARNING: there is no transaction in progress
ROLLBACK
test=# SELECT * FROM t1;
id
----
1
(1 row)
test=# ROLLBACK AND CHAIN;
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
test=# BEGIN;
BEGIN
test=*# ROLLBACK AND CHAIN;
ROLLBACK
test=*# INSERT INTO t1 VALUES(2);
INSERT 0 1
test=*# ROLLBACK;
ROLLBACK
test=# SELECT * FROM t1;
id
----
1
(1 row)
https://crate.io/docs/sql-99/en/latest/chapters/36.html indicates that this is part of the SQL:1999 standard.
I don't think these options are commonly used in MySQL. However I would not be surprised if some benchmarks or other tools use rollback release
to force a connection reset.
https://github.com/pingcap/parser/blob/7b490931db5f6fa20180d3097339bac3969f3160/parser.y#L7680 seems to be aware of the syntax.
https://github.com/pingcap/tidb/blob/9c75cfa4e2bbb854ab90562ecec0409f84a989b0/executor/simple.go#L745 doesn't seem to use the CompletionType
of the RollbackStmt
.
Thanks for your report!
Now we only support chain
and release
on syntax. We handle it in pingcap/parser/pull/751.
Bug Report
1. Minimal reproduce step (Required)
MySQL:
TiDB:
2. What did you expect to see? (Required)
ROLLBACK AND CHAIN
ROLLBACK RELEASE
3. What did you see instead (Required)
Both
AND CHAIN
andRELEASE
options forROLLBACK
seem to get ignored silently.4. What is your TiDB version? (Required)