Skip to content

sql-statements: use EBNF to render syntax diagrams - second batch (#5376)#5406

Closed
ti-srebot wants to merge 4 commits into
pingcap:release-2.1from
ti-srebot:release-2.1-541d0a6b1ba7
Closed

sql-statements: use EBNF to render syntax diagrams - second batch (#5376)#5406
ti-srebot wants to merge 4 commits into
pingcap:release-2.1from
ti-srebot:release-2.1-541d0a6b1ba7

Conversation

@ti-srebot
Copy link
Copy Markdown
Contributor

@ti-srebot ti-srebot commented Jan 26, 2021

cherry-pick #5376 to release-2.1
You can switch your code base to this Pull Request by using git-extras:

# In docs-cn repo:
git pr https://github.com/pingcap/docs-cn/pull/5406

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/docs-cn.git pr/5406:release-2.1-541d0a6b1ba7

What is changed, added or deleted? (Required)

This PR changes the synopsis sections of BEGIN, CHANGE, COMMIT, CREATE, DEALLOCATE, DELETE, DO, and DROP statements to use the ```ebnf+diagrm block, replacing the original image-based sqlgrams. It is a follow-up PR to pingcap/docs#4389.

To avoid making one single PR too large, I will open 4-5 follow-up PRs to process sql-statements files in batches. And I will delete all image files in the last PR in case of any display issues.

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)
  • v5.0 (TiDB 5.0 versions)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot ti-srebot added status/PTAL This PR is ready for reviewing. type/cherry-pick-for-release-2.1 This PR is cherry-picked to release-2.1 from a source PR. requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. labels Jan 26, 2021
@ti-srebot ti-srebot requested review from TomShawn and kennytm January 26, 2021 09:20
@ti-srebot
Copy link
Copy Markdown
Contributor Author

@CharLotteiu you're already a collaborator in bot's repo.

Comment on lines +17 to +18
DatabaseSym ::=
DATABASE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These lines are newly added. Please take a look~ @kennytm

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it should be DatabaseSym ::= 'DATABASE' | 'SCHEMA', e.g. CREATE SCHEMA ... is a valid CreateDatabaseStmt.

Comment on lines +17 to +18
CreateIndexStmtUnique ::=
UNIQUE?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as the previous comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i guess this should be inlined into IndexType. BTW 'UNIQUE' not UNIQUE.

Comment on lines +32 to +33
IndexColNameList ::=
IndexColName (',' IndexColName)*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as the previous comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

superseded by IndexPartSpecificationList.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it alright to use IndexPartSpecificationList in docs for release 2.1?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if CREATE INDEX i ON t (col(123)); works on 2.1 then it should be IndexPartSpecificationList.

if not the IndexPartSpecificationList in CreateIndexStmt should be replaced by IndexColNameList.

Comment on lines +47 to +48
TableOptionListOpt ::=
'' | TableOption* ( ',' TableOption* )*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@kennytm Please take a look at these lines as well. Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lolwut 🤣

Suggested change
TableOptionListOpt ::=
'' | TableOption* ( ',' TableOption* )*
TableOptionListOpt ::=
(TableOption (','? TableOption)*)?

also CreateTableOptionListOpt is equivalent to TableOptionListOpt.

@ti-srebot
Copy link
Copy Markdown
Contributor Author

@CharLotteiu, @kennytm, @TomShawn, PTAL.

1 similar comment
@ti-srebot
Copy link
Copy Markdown
Contributor Author

@CharLotteiu, @kennytm, @TomShawn, PTAL.

@CharLotteiu
Copy link
Copy Markdown
Contributor

CharLotteiu commented Feb 1, 2021

Closed as we decided not to maintain the EBNF code of synopsis on the release-2.1 branch.

@CharLotteiu CharLotteiu closed this Feb 1, 2021
@TomShawn TomShawn removed status/PTAL This PR is ready for reviewing. type/cherry-pick-for-release-2.1 This PR is cherry-picked to release-2.1 from a source PR. requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. labels Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants