Skip to content

Conversation

marcaurele
Copy link
Contributor

Change how the server version is retrieved to handle a bug with mariadb and mysql native client not stripping the 5.5.5- prefix.

Change how the server version is retrieved to handle a bug with
mariadb and mysql native client not stripping the `5.5.5-` prefix.
@timgraham
Copy link
Member

@adamchainz, I know you've done some related work in django-mysql. Do you agree with the proposed changes?

@adamchainz
Copy link
Member

Seems legit but I don't quite follow what the feature detection problem is as described in the ticket. Was MySQLdb reporting 5.5.5-10... which Django interpreted as 5.5.5 and thus didn't enable things like microseconds on DATETIME?

In general there are lots of feature detection problems between MySQL and MariaDB, e.g. microseconds have been supported in MariaDB since 5.3, whilst Django currently only checks for >5.6 since it only worries about connecting to MySQL. As MariaDB takes a larger market share it should probably move to supporting it as a first class citizen.

@marcaurele
Copy link
Contributor Author

Yes, that's exactly the problem you're describing @adamchainz , sorry for not being clear enough in my description. I wrote more in the bug description on track ticket which I thought people will look at too (https://code.djangoproject.com/ticket/26868):

I found an edge case when you connect to mariadb server using the mysql client library, for example running a MySQL server on a local computer, which will install the client library but using a MariaDB in a docker container.

The server string returned by the server is 5.5.5-10.0.25-MariaDB-1jessie and therefore the features list is incorrect, especially for the microsecond precision on the DATETIME. If you're using the mariadb client library you will get 10.0.25-MariaDB-1jessie and the features list is correct.
https://mariadb.atlassian.net/browse/MDEV-4575

My ​PR changes how the version is detected, and use a SQL query instead of the client library call. Then we get the correct MariaDB version and the features list is correct.

I also understand the point with MariaDB taking a larger share and should have it's own connector. My goal was to make it a bit more compatible until such a connector is developed.

@adamchainz
Copy link
Member

Ok then this looks good to me.

@marcaurele
Copy link
Contributor Author

Would be nice if it could still be merged in the 1.10

@timgraham
Copy link
Member

merged in f8bfa80, thanks!

@timgraham timgraham closed this Jul 15, 2016
@marcaurele marcaurele deleted the fix-26868 branch December 2, 2016 14:46
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.

3 participants