-
Notifications
You must be signed in to change notification settings - Fork 214
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
Checkit function creation causing error when binary logging enabled - MySQL DB #824
Comments
I don't know, I would have to defer to a MySQL expert to determine the appropriate solution here. |
@Edwards80 I ran into the same problem and I think the issue is that with binary logging enabled, CREATE FUNCTION is only allowed if both of the following conditions are met:
As the @theory It would be great if sqitch could be changed to only issue a warning, when the creation of I think this issue affects all MySQL cloud databases that have a replica configured. |
As I wanted to fix this problem for me, I dug a bit deeper into this. I was able to fix this locally for me, be removing the App/Sqitch/Engine/mysql.sql:
AFAIK, the triggers do not have to be changed. The I think the best would be to patch the The following SQL can be used to fetch the relevant configuration data:
It would be great if someone with Perl knowledge could implement this, but if that's not happening, I may give it a try myself. |
That sounds like a decent plan, and the mysql tests will ensure it functions properly on all (most?) supported versions of MySQL and MariaDB. You can borrow from pg.pm's _run_registry_file method for how to check version numbers and use the command-line methods to detect various things and then modify the registry SQL script as appropriate. You'd want to make the changes you propose in the context of mysql.pm's run_upgrade method. I would assume that this change only needs to be applied as of some recent-ish version of MySQL, yes? Also MariaDB or no? Something like this: if ($self->_fractional_seconds) {
if ( $self->dbh->{mysql_serverversion} >= $someversion && $self->_probe('-c', q{
SELECT @@log_bin, @@log_bin_trust_function_creators,
IF(SUM(privilege_type = 'SUPER') > 0, 'YES', 'NO') AS has_super
FROM information_schema.user_privileges
WHERE grantee = CONCAT("'", CURRENT_USER(), "'");
}) {
my $sql = scalar $file->slurp;
# Replace checkit here.
require File::Temp;
my $fh = File::Temp->new;
print $fh $sql;
close $fh;
$self->sqitch->run( @cmd, $self->_source($fh->filename) )
} else {
# Use previous code.
$self->sqitch->run( @cmd, $self->_source($file) );
}
} Although it looks like that query returns "YES" or "NO"; better if it returns 1 or 0 in this context. |
We have binary logging enabled on a MySQL 5.7 DB but the deploy scripts fail with SQL Error 1419
"You do not have super user privilege and binary logging is enabled"
This error is caused by the creation of the checkit function, however we do not use the function in our verify scripts.
Is there a fix for this that doesn't involve setting log_bin_trust_function_creators to true?
The text was updated successfully, but these errors were encountered: