Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Non-portable SQL statement in lib/Db/Maintenance.php #1191

Closed
stmichalke opened this issue Jan 3, 2025 · 3 comments
Closed

Non-portable SQL statement in lib/Db/Maintenance.php #1191

stmichalke opened this issue Jan 3, 2025 · 3 comments
Labels

Comments

@stmichalke
Copy link

Commit 1b0ec6b uses a string comparison which doesn't work with PostgreSQL:
WHERE `key` = "scanning"
It should be 'scanning' because double quotes delimit column names, not string constants.

@frake65
Copy link

frake65 commented Jan 3, 2025

Actually, I think there are the following lines in file lib/Db/Maintenance.php which should be modified:
Line 34:
WHERE key = \'scanning\'';
Line 48:
WHERE key = \'scanning\'';
Line 61:
$sql = 'SELECT 1 FROM *PREFIX*music_cache WHERE key = \'scanning\'';

thank you!

@paulijar paulijar added the Bug label Jan 3, 2025
@paulijar
Copy link
Collaborator

paulijar commented Jan 3, 2025

Thanks for the info, I didn't know this about PostgreSQL and majority of my testing has been on MariaDB and SQLite.

paulijar added a commit that referenced this issue Jan 3, 2025
In PostgreSQL, double quotes (") denote a column or table name instead of
string literal. This differs from MariaDB and SQLite.

refs #1191
@paulijar
Copy link
Collaborator

paulijar commented Jan 3, 2025

I published a hotfix 2.1.1 fixing this issue.

@paulijar paulijar closed this as completed Jan 3, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants