Skip to content

Conversation

@kolbe
Copy link
Collaborator

@kolbe kolbe commented Oct 14, 2025

This is the first step toward implementing #446

This PR adds support for parsing CREATE TABLE statements using the TiDB parser. This support is primarily targeted toward parsing "canonical" CREATE TABLE statements, the ones returned by SHOW CREATE TABLE. The new support is not currently used, but will form the basis for future work that implements native linting.

It should be possible to parse any legal MySQL CREATE TABLE statement using this functionality, but it's also possible to parse many invalid statements (multiple primary keys, non-unique column names, indexes on columns that don't exist, etc.).

Many column/index/constraint attributes are expressed as pointers, following the general pattern in go structs when it should be possible to determine whether a field has any value set rather than just some default value.

This library provides convenient access to most aspects of a table, as well as access to the "raw" AST that comes back from the TiDB parser for more in-depth analysis depending on the situation.

kolbe added 8 commits October 14, 2025 16:13
* origin/main: (66 commits)
  fix spelling
  continue for watermark not ready cases.
  remove unneeded files
  Improve table notified panic handling, and can't write checkpoint handling
  fix other test
  Return error when using non alter statements in mutli change
  Fix flush correctness issue
  fix: minor typo
  fix race
  fix NULL returning
  skip new test
  fix races
  Add boundary checking, improve buffered copier
  Add tests
  fix comments - removing force-inplace
  add drop index to safe operations category - removing force-inplace
  reword usage docs - removing force-inplace
  Update pkg/migration/runner_test.go
  remove force-inplace - since we don't want to be in the business of doing things that are not safe
  Add support for resume from checksum in multi chunker
  ...
@kolbe kolbe marked this pull request as ready for review October 15, 2025 20:13
Copy link
Collaborator

@morgo morgo left a comment

Choose a reason for hiding this comment

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

LGTM

@kolbe kolbe merged commit c169766 into main Oct 16, 2025
10 checks passed
@morgo morgo mentioned this pull request Oct 17, 2025
kolbe added a commit that referenced this pull request Oct 17, 2025
* origin/main:
  add support for parsing CREATE TABLE (#486)
  remove checksum option
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