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

Returning a MariaDB DSN for a mysql URI seems very badly behaved #29

Open
Altreus opened this issue Mar 25, 2025 · 2 comments · May be fixed by #30
Open

Returning a MariaDB DSN for a mysql URI seems very badly behaved #29

Altreus opened this issue Mar 25, 2025 · 2 comments · May be fixed by #30

Comments

@Altreus
Copy link

Altreus commented Mar 25, 2025

DBD::MariaDB does not support the same options as DBD::mysql, so this change is not backward-compatible and will break anyone who's expecting mysql to mean mysql.

(My objections to using mysql in the first place are a matter of record)

@theory
Copy link
Collaborator

theory commented Mar 25, 2025

You suggest using a DBD::mysql DSN for db:mysql, then? How are they different? I've heard no complaints so far, and the sqitch change was relatively straightforward. Although I guess since it always uses DBD::MariaDB (even with older versions of URI::db), it knows to no longer use the mysql_ options. Perhaps that's what you mean?

@Altreus
Copy link
Author

Altreus commented Mar 26, 2025

DBD::MariaDB is not a drop-in replacement for DBD::mysql, so this change isn't backward-compatible.

I downgraded sqitch to work around the issue I reported over there (the one about the mysql.users table), and ran into even more problems because that version of sqitch was passing mysql_enable_utf8 to the driver, but URI::db was telling it to use MariaDB for a mysql URI.

I suppose at the core, the issue is that a URI::db object can give you a DSN with a driver in it, but the code that asks for that info doesn't actually know what driver that will be; but different drivers support different options, so the code is still going to have to decide what to pass to connect. dbi_dsn is therefore most likely to be used as a helper method—i.e. to make it simpler to pass options to connect—than a decider method, i.e. to pick what driver to use in the first place.

sqitch itself is an example of that: back in version 1.3.0, it was assuming that URI::db was going to tell it to use the mysql driver, and therefore passed mysql options to it. That seems like a reasonable assumption to have made, so any code working on the same assumptions is going to break.

theory added a commit that referenced this issue Mar 30, 2025
But leave URI::mariadb using DBD::MariaDB. Fixes #29.
@theory theory linked a pull request Mar 30, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants