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

Omit MySQL checkit() when it cannot be created #852

Closed
wants to merge 1 commit into from

Conversation

theory
Copy link
Collaborator

@theory theory commented Jan 2, 2025

Remove the use of the checkit() function from the MySQL triggers that enforce constraints on the dependencies table, then modify the deployment of MySQL registry scripts to remove checkit() when MySQL is using binary logging and Sqitch is not a super user. Fixes #824, which reports that MySQL with binary logging enabled disallows the creation of DETERMINISTIC functions by non-super users. In such a configuration, Sqitch itself functions exactly as before, but checkit() is not available for use in verify scripts.

Refactor the MySQL engine's run_upgrade() method to move the rejiggering of a file to a new method, _prepare_registry_file. Teach that method then to remove bits of the script as appropriate to the MySQL version and permissions.

Update the MySQL tutorial to note how to add checkit() if it's missing.

Remove the use of the `checkit()` function from the MySQL triggers that
enforce constraints on the `dependencies` table, then modify the
deployment of MySQL registry scripts to remove `checkit()` when MySQL is
using binary logging and Sqitch is not a super user. Fixes #824, which
reports that MySQL with binary logging enabled disallows the creation of
`DETERMINISTIC` functions by non-super users. In such a configuration,
Sqitch itself functions exactly as before, but `checkit()` is not
available for use in verify scripts.

Refactor the MySQL engine's `run_upgrade()` method to move the
rejiggering of a file to a new method, `_prepare_registry_file`. Teach
that method then to remove bits of the script as appropriate to the
MySQL version and permissions.

Update the MySQL tutorial to note how to add `checkit()` if it's
missing.
@theory theory requested a review from autarch January 2, 2025 17:09
@theory theory self-assigned this Jan 2, 2025
@theory
Copy link
Collaborator Author

theory commented Jan 2, 2025

I'm not positive this is the best way to detect in a single query whether the current user is a super user:

SELECT md5(super_priv) = md5('Y') FROM mysql.user
 WHERE CONCAT(user, '@', host) = current_user

It works, but I don't know what all the wrinkles are. Like, are there conditions when current_user quotes the username or hostname?

Copy link
Contributor

@autarch autarch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@theory
Copy link
Collaborator Author

theory commented Jan 4, 2025

Merged in 93a0d1f.

@theory theory closed this Jan 4, 2025
@theory theory deleted the issue-824-mysql branch January 4, 2025 18:16
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.

Checkit function creation causing error when binary logging enabled - MySQL DB
2 participants