Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect to database using SET NAMES utf8mb4 #17716

Merged
merged 1 commit into from
Jun 30, 2020

Conversation

mattwire
Copy link
Contributor

Overview

Alternative to #17696 as discussed by @pfigel @mfb @demeritcowboy @eileenmcnaughton @seamuslee001 . The use of SET NAMES utf8mb4 has no impact on supported mysql versions for CiviCRM even if the site is not using utf8mb4.

I've switched all uses of SET NAMES (that I could find) to utf8mb4

Before

Database connection with SET NAMES utf8 - can't use utf8mb4 characters.

After

Database connection with SET NAMES utf8mb4 - can use utf8mb4 characters.

Technical Details

Comments

@civibot
Copy link

civibot bot commented Jun 30, 2020

(Standard links)

@civibot civibot bot added the master label Jun 30, 2020
@mattwire mattwire changed the title SET NAMES utf8mb4 Connect to database using SET NAMES utf8mb4 Jun 30, 2020
@seamuslee001
Copy link
Contributor

Test failure is unrelated. I think this has the broad support based on @demeritcowboy 's comment here #17696 (comment) I'm going to merge this

@seamuslee001 seamuslee001 merged commit 1611013 into civicrm:master Jun 30, 2020
@demeritcowboy
Copy link
Contributor

demeritcowboy commented Jul 1, 2020

Ha ha @seamuslee001 is confusing me with @pfigel which is a win for me at least (no comment on how that will ultimately work out for you @pfigel). I suppose I'm obligated now to add something more useful to the conversation:

Joins should be fine since that wouldn't depend on SET NAMES and would depend on the COLLATION of the column definitions. So at worst it would still use the index but would slow down since it would have to convert to compare, but that's the same as regular utf8 if you define columns with different utf8_XXX collations.

Yes that sounded intelligent enough, so it doesn't even matter if it's true. (It is though - quick test confirms it - EXPLAIN shows it using index but also has the word "func", which of course means conversion).

@eileenmcnaughton
Copy link
Contributor

@demeritcowboy yes high praise - but I think you deserve it :-).

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