Summary: | RANK is a reserved word in MySQL 8.0.2+ | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | Database | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | Needs documenting --- | QA Contact: | Martin Renvoize (ashimema) <martin.renvoize> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, emily.lamancusa, fridolin.somers, lucas, martin.renvoize, tomascohen |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This fixes adding a patron to a routing list after receiving a serial - the patron was not being added to the routing list. This issue was only happing where MySQL 8.0.2 or later was used as the database for Koha. This was because the SQL syntax in the SQL used RANK, which become a reserved word in MySQL 8.0.2.
|
Version(s) released in: |
24.11.00,24.05.04
|
Circulation function: | |||
Bug Depends on: | 26567 | ||
Bug Blocks: | 37480 | ||
Attachments: |
Bug 37476: Unit tests
Bug 37476: Fix reserved word error on Serials.pm on MySQL 8 Bug 37476: Unit tests Bug 37476: Fix reserved word error on Serials.pm on MySQL 8 Bug 37476: Unit tests Bug 37476: Fix reserved word error on Serials.pm on MySQL 8 |
Description
Tomás Cohen Arazi (tcohen)
2024-07-25 14:21:00 UTC
Created attachment 169609 [details] [review] Bug 37476: Unit tests Created attachment 169610 [details] [review] Bug 37476: Fix reserved word error on Serials.pm on MySQL 8 This patch fixes the fact `RANK` become a reserved word in MySQL 8.0.2 [1] To test: 1. Launch KTD with MySQL 8: $ ktd down $ DB_IMAGE=mysql:8 ktd up -d 2. Open the logs $ ktd --shell k$ tail -f /var/log/koha/kohadev/*.log 3. Create a serial, receive an issue and try to create a routing list 4. Click on `+ Add recipients` and look for Henry 5. Click `Add` and then `Close` => FAIL: Henry not added => FAIL: The logs show an error about wrong SQL syntax 6. Run: k$ prove t/db_dependent/Serials.t => FAIL: Tests explode with the same kind of error! 6. Apply this patch 7. Restart plack 8. Repeat 3 through 6 => SUCCESS: Henry added! => SUCCESS: No explosion about the SQL syntax in the logs => SUCCESS: Tests pass! 9. Sign off :-D [1] https://dev.mysql.com/doc/refman/8.0/en/keywords.html Created attachment 169702 [details] [review] Bug 37476: Unit tests Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Created attachment 169703 [details] [review] Bug 37476: Fix reserved word error on Serials.pm on MySQL 8 This patch fixes the fact `RANK` become a reserved word in MySQL 8.0.2 [1] To test: 1. Launch KTD with MySQL 8: $ ktd down $ DB_IMAGE=mysql:8 ktd up -d 2. Open the logs $ ktd --shell k$ tail -f /var/log/koha/kohadev/*.log 3. Create a serial, receive an issue and try to create a routing list 4. Click on `+ Add recipients` and look for Henry 5. Click `Add` and then `Close` => FAIL: Henry not added => FAIL: The logs show an error about wrong SQL syntax 6. Run: k$ prove t/db_dependent/Serials.t => FAIL: Tests explode with the same kind of error! 6. Apply this patch 7. Restart plack 8. Repeat 3 through 6 => SUCCESS: Henry added! => SUCCESS: No explosion about the SQL syntax in the logs => SUCCESS: Tests pass! 9. Sign off :-D [1] https://dev.mysql.com/doc/refman/8.0/en/keywords.html Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Testing notes: DB_IMAGE=mysql:8 didn't work for me, but DB_IMAGE=mysql:8.0 did. Otherwise all works as it should! (In reply to Emily Lamancusa from comment #5) > Testing notes: DB_IMAGE=mysql:8 didn't work for me, but DB_IMAGE=mysql:8.0 > did. Otherwise all works as it should! Thanks! I should've copied and pasted my command instead of typing it :-D Created attachment 169722 [details] [review] Bug 37476: Unit tests Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 169723 [details] [review] Bug 37476: Fix reserved word error on Serials.pm on MySQL 8 This patch fixes the fact `RANK` become a reserved word in MySQL 8.0.2 [1] To test: 1. Launch KTD with MySQL 8: $ ktd down $ DB_IMAGE=mysql:8 ktd up -d 2. Open the logs $ ktd --shell k$ tail -f /var/log/koha/kohadev/*.log 3. Create a serial, receive an issue and try to create a routing list 4. Click on `+ Add recipients` and look for Henry 5. Click `Add` and then `Close` => FAIL: Henry not added => FAIL: The logs show an error about wrong SQL syntax 6. Run: k$ prove t/db_dependent/Serials.t => FAIL: Tests explode with the same kind of error! 6. Apply this patch 7. Restart plack 8. Repeat 3 through 6 => SUCCESS: Henry added! => SUCCESS: No explosion about the SQL syntax in the logs => SUCCESS: Tests pass! 9. Sign off :-D [1] https://dev.mysql.com/doc/refman/8.0/en/keywords.html Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Thanks for the fix here Tomas.. Passing QA Thanks for all the hard work! Pushed to main for the next 24.11.00 release as RM Assistant Backported to 24.05.x for upcoming 24.05.04 Depends on Bug 26567 not in 23.11.x |