Skip to content

parser: support DELETE FROM ... AS ... syntax#383

Merged
bb7133 merged 2 commits into
pingcap:masterfrom
kennytm:delete-from-alias
Jul 18, 2019
Merged

parser: support DELETE FROM ... AS ... syntax#383
bb7133 merged 2 commits into
pingcap:masterfrom
kennytm:delete-from-alias

Conversation

@kennytm
Copy link
Copy Markdown
Contributor

@kennytm kennytm commented Jul 10, 2019

What problem does this PR solve?

Fix issue pingcap/tidb#11173. The DELETE FROM ... AS ... syntax was introduced in MySQL 8.0.16.

What is changed and how it works?

Recognize the new syntax in the parser.

Check List

Tests

  • Unit test

Code changes

Side effects

Related changes

@kennytm
Copy link
Copy Markdown
Contributor Author

kennytm commented Jul 10, 2019

(Integration test requires pingcap/tidb#11184 to pass)

@kennytm
Copy link
Copy Markdown
Contributor Author

kennytm commented Jul 11, 2019

PTAL @tiancaiamao @shenli

@imtbkcat
Copy link
Copy Markdown

Hi kennytm, i try to run this SQL in MySQL 8.0, but failed.

mysql> DELETE FROM x t WHERE t.a = 4;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't WHERE t.a = 4' at line 1

@kennytm
Copy link
Copy Markdown
Contributor Author

kennytm commented Jul 11, 2019

@imtbkcat

https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-16.html

For consistency with the SQL standard and other RDBMS, table aliases are now supported in single-table as well as multi-table DELETE statements. (Bug #27455809)

Copy link
Copy Markdown

@imtbkcat imtbkcat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kennytm kennytm added the status/LGT1 LGT1 label Jul 12, 2019
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 18, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@ded7e04). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #383   +/-   ##
=========================================
  Coverage          ?   70.11%           
=========================================
  Files             ?       32           
  Lines             ?     7394           
  Branches          ?        0           
=========================================
  Hits              ?     5184           
  Misses            ?     1698           
  Partials          ?      512
Impacted Files Coverage Δ
parser.go 70.58% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ded7e04...6f92153. Read the comment docs.

Copy link
Copy Markdown
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bb7133 bb7133 added DNM and removed DNM labels Jul 18, 2019
@bb7133
Copy link
Copy Markdown
Member

bb7133 commented Jul 18, 2019

hi @kennytm , please update TiDB test case:

(write_test.go:1747: testSuite4.TestQualifiedDelete)

1767     _, err := tk.Exec("delete from t1 as a where a.c1 = 1")
1768     c.Assert(err, NotNil)

@bb7133 bb7133 added status/LGT2 LGT2 and removed status/LGT1 LGT1 labels Jul 18, 2019
@bb7133 bb7133 merged commit 601cede into pingcap:master Jul 18, 2019
@kennytm kennytm deleted the delete-from-alias branch July 19, 2019 04:23
tiancaiamao pushed a commit to tiancaiamao/parser that referenced this pull request Apr 27, 2021
lyonzhi pushed a commit to lyonzhi/parser that referenced this pull request Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants