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

SQL temp table not using utf8mb4 if server default already set to utf8mb4 #18012

Merged
merged 1 commit into from
Aug 1, 2020

Conversation

demeritcowboy
Copy link
Contributor

@demeritcowboy demeritcowboy commented Jul 31, 2020

Overview

A unit test was failing locally with row size too large but the db settings should have supported it. (CRM/Export/BAO/ExportTest.php)

Technical Details

One thing was createWithColumns was not using the getUtf8String() helper, so it was overriding the server default and putting utf8.

Another thing is that it wasn't clear what the intent of the if statement in that function was. If it was meant to be a boolean AND, then it would always fail. If it was meant to be a boolean OR, as I suspect, then why two clauses.

Comments

I don't know the exact server settings on the PR test sites but I'm a little confused as to why the test was working there before and not also getting row size too large. Maybe a different page_size or something?

@civibot
Copy link

civibot bot commented Jul 31, 2020

(Standard links)

@civibot civibot bot added the master label Jul 31, 2020
@eileenmcnaughton
Copy link
Contributor

I think this is right. My head started hurting though.

@eileenmcnaughton
Copy link
Contributor

OK I think what is hurting is the $this-utf8 part. Perhaps making it

  protected $utf8 = TRUE;

would be clearer - although I suspect the possibility of it being false is null & void now & it could just go.

Anyway this change makes sense

@eileenmcnaughton eileenmcnaughton merged commit f417887 into civicrm:master Aug 1, 2020
@demeritcowboy demeritcowboy deleted the utf8mb4-temptable branch August 1, 2020 13:53
@demeritcowboy
Copy link
Contributor Author

I agree the utf8 param can be removed, and it would seem reasonable to up the requirements to say you MUST use some variation of utf8 for your default db settings, since all the supported databases support that.

The setUtf8() function doesn't seem used in core and is actually marked deprecated just doesn't call the warning function, and as it notes in the comment if you really want a different charset/collation you can still do that on a per-column basis.

@eileenmcnaughton
Copy link
Contributor

@demeritcowboy - #18133 - hit an issue with this when testing against our CI

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.

2 participants