Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

sql/*: add some more compatibility with mysqldump #258

Closed

Conversation

erizocosmico
Copy link
Contributor

This is only a part of what should be implemented to be compatible with mysqldump, more info at: src-d/gitbase#361

What this includes:

  • Remove comments.
  • Empty queries do not crash (see the /* SOME QUERY INSIDE COMMENT*/).
  • SHOW VARIABLES, which returns a dummy result.
  • SET, which returns an dummy result.
  • @@GLOBAL.FOO and @@SESSION.FOO always return nil and can be resolved.
  • SHOW DATABASES.
  • LOCK, which returns a dummy result.
  • USE, which returns a dummy result

@erizocosmico erizocosmico requested a review from ajnavarro July 3, 2018 13:46
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
@erizocosmico erizocosmico force-pushed the feature/mysqldump-compat-1 branch from 501f724 to 6c9f5e3 Compare July 3, 2018 13:47
@ajnavarro
Copy link
Contributor

What do you think about "decouple" all this specific logic to make this compatible with mysqldump?

Maybe we can add some hooks before the query parser to be able to discard or do something with the query string before sending it to the parser.

Regarding specific tables or fields, we can add separated rules for them on the analyzer.

WDYT?

@erizocosmico
Copy link
Contributor Author

How is mysqldump going to hook into it? We don't know if a client is mysqldump or not.

@smola
Copy link
Collaborator

smola commented Jul 4, 2018

We don't want to add specific logic for mysqldump. Mysqldump itself is not that important for us, what we would like instead is that every time we add some feature that improves compatibility, other tools benefit. Otherwise, we'll end up with a pile of hacks that only work with mysqldump and Tableau.

@erizocosmico
Copy link
Contributor Author

This does not contain any mysqldump-specific logic. This only contains "hacks" for making some queries not fail. Queries you could do with any kind of MySQL client. They just happen to be some of the ones mysqldump does.

But yes, it's a pile of hacks to make it work (not really, though) with mysqldump. Right solution would be to properly implement all this, but I don't know if we want to do that right now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants