Skip to content

mysql_database: prevent syntax error with collate=>'binary' #565

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

Merged
merged 1 commit into from
Sep 16, 2014

Conversation

mmonaco
Copy link
Contributor

@mmonaco mmonaco commented Sep 11, 2014

On MySQL v5.5.38, creating a database such as:

CREATE DATABASE `mydb` CHARACTER SET binary COLLATE binary;

seems to hit a parser bug. A workaround is simply to quote COLLATE
binary. As the quoting is harmless, and for aesthetics, quote both
the CHARACTER SET and COLLATE arguments.

@mmonaco
Copy link
Contributor Author

mmonaco commented Sep 11, 2014

Hrm, I see the CI build failed but I don't think it was caused by this patch...

@igalic
Copy link
Contributor

igalic commented Sep 11, 2014

actually, it is:

 Mocha::ExpectationError:

unexpected invocation: #<Puppet::Type::Mysql_database::ProviderMysql:0x69893f0>.mysql(['--defaults-extra-file=/root/.my.cnf', '-NBe', 'create database if not exists `new_database` character set `latin1` collate `latin1_swedish_ci`'])

unsatisfied expectations:

- expected exactly once, not yet invoked: #<Puppet::Type::Mysql_database::ProviderMysql:0x69893f0>.exists?(any_parameters)

- expected exactly once, not yet invoked: #<Puppet::Type::Mysql_database::ProviderMysql:0x69893f0>.mysql(['--defaults-extra-file=/root/.my.cnf', '-NBe', 'create database if not exists `new_database` character set latin1 collate latin1_swedish_ci'])

i think you'll have to adapt the tests in spec/unit/...

@mmonaco
Copy link
Contributor Author

mmonaco commented Sep 16, 2014

Ah, @igalic, I'm sorry. I don't know why github didn't email me after your response. I'll take a look at the spec, thanks for the pointer.

On MySQL v5.5.38, creating a database such as:

	CREATE DATABASE `mydb` CHARACTER SET binary COLLATE binary;

seems to hit a parser bug. A workaround is simply to quote COLLATE
`binary`. As the quoting is harmless, and for aesthetics, quote both
the CHARACTER SET and COLLATE arguments.
@mmonaco
Copy link
Contributor Author

mmonaco commented Sep 16, 2014

Ok @igalic, so I saw last time that the puppet-2.7 builds failed and didn't look further. I fixed the 3+ issue, but I still don't see how anything in my pull request affected the errors in the first two jobs.

@igalic
Copy link
Contributor

igalic commented Sep 16, 2014

2.7 has been broken for quite some time, and we keep ignoring it (i'd rather we removed it, but it's not officially EOL/EOS just yet)

igalic added a commit that referenced this pull request Sep 16, 2014
mysql_database: prevent syntax error with collate=>'binary'
@igalic igalic merged commit 86c7fcf into puppetlabs:master Sep 16, 2014
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.

3 participants