[Bug 42412] New: Upgrade to 25.11.02.004 with MySQL 8.4.7 (on ubuntu 24.04.4) fails with Exception: Incorrect DATE value: value: '0000-00-00'
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Bug ID: 42412 Summary: Upgrade to 25.11.02.004 with MySQL 8.4.7 (on ubuntu 24.04.4) fails with Exception: Incorrect DATE value: value: '0000-00-00' Initiative type: --- Sponsorship --- status: Product: Koha Version: 25.05 Hardware: PC OS: Linux Status: NEW Severity: major Priority: P5 - low Component: Installation and upgrade (command-line installer) Assignee: koha-bugs@lists.koha-community.org Reporter: djalel.chefrour@univ-soukahras.dz QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com Post installation script fails when upgrading to 25.11.02.004 on Ubuntu 24.04.4 LTS with mysql-server 8.4.7-1ubuntu24.04 Error message from: sudo apt upgrade ... Setting up koha-common (25.11.03-2) ... Upgrading database schema for lib Upgrade to 25.11.02.001 [14:38:35]: Bug 41682 - Fix syspref discrepancies between new and upgraded installs Upgrade to 25.11.02.002 [14:38:36]: Bug 28308 - Remove unnecessary message preference entries Upgrade to 25.11.02.003 [14:38:36]: Bug 41287 - Add option for stringwise sorting of facets Added new 'Stringwise' option to system preference 'FacetOrder' Upgrade to 25.11.02.004 [14:38:36]: Bug 36466 - Fix the incorrect 0000-00-00 date in planneddate and publisheddate field ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Incorrect DATE value: '0000-00-00' at /usr/share/koha/lib/C4/Installer.pm line 825 dpkg: error processing package koha-common (--configure): installed koha-common package post-installation script subprocess returned error exit status 1 I fixed the issue by editing /usr/share/koha/intranet/cgi-bin/installer/data/mysql/db_revs/251102004.pl to add the lines # Force session sql_mode to allow 0000-00-00 comparisons $dbh->do(q{SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION'}); ahead of $dbh->do(q{UPDATE serial SET planneddate=NULL WHERE planneddate='0000-00-00'}); $dbh->do(q{UPDATE serial SET publisheddate=NULL WHERE publisheddate='0000-00-00'}); Sorry I can't help further with your bug management process -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Djalel CHEFROUR <djalel.chefrour@univ-soukahras.dz> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Saiful Amin <saiful@semanticconsulting.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |CONFIRMED CC| |saiful@semanticconsulting.c | |om --- Comment #1 from Saiful Amin <saiful@semanticconsulting.com> --- This is due to strict SQL mode (NO_ZERO_DATE) enabled by default in MySQL, which prevents zero date comparison. A temporary fix would be to disable SQL strict modes for this update, by editing this file: /usr/share/koha/intranet/cgi-bin/installer/data/mysql/db_revs/251102004.pl Add `SET SESSION sql_mode = '';` before the date updates. After editing the file, it should look like this: 10 # Do you stuffs here +11 $dbh->do(q{SET SESSION sql_mode = '';}); 12 $dbh->do(q{update serial set planneddate=null where planneddate='0000-00-00';}); 13 $dbh->do(q{update serial set publisheddate=null where publisheddate='0000-00-00';}); Restarting database upgrade (`koha-upgrade-schema <instance>`) or simply `apt upgrade` should finish the upgrades successfully. --- PS: Looking at your mysql-server version 8.4.7, I think you may get into other problems, which are noted in https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39107 Currently Koha only works with MySQL version up to 8.0.x -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Saiful Amin <saiful@semanticconsulting.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|25.05 |25.11 Priority|P5 - low |P1 - high Severity|major |blocker -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #2 from Djalel CHEFROUR <djalel.chefrour@univ-soukahras.dz> --- Thanks for your PS note. Indeed, MySQL 8.4+ does enforce key uniqueness on those Koha illrequests FK constraints. Though, I did not notice the issue while upgrading our DB from MySQL 8.0.4 to 8.4.7. But, a week ago, I saw those SQL failures (as in bug 39107) when I tried a fresh import of our DB dump (post-upgrade) to a new local MySQL 8.4.7 for development. I guess the MySQL guys did not enforce unique keys for existing constraints in their upgrade process (which is probably a wise decision for backwards compatibility). Luckily, those constraints in illrequest still exist in the backup dump and show up with SHOW CREATE TABLE Another factor that allowed me to doge a bullet is the fact that we don't use ILL for now (our illrequests table is empty). Hopefully, I am on the safe side for future Koha releases that will support SQL 8.4+ -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #3 from Saiful Amin <saiful@semanticconsulting.com> --- (In reply to Djalel CHEFROUR from comment #2)
Hopefully, I am on the safe side for future Koha releases that will support SQL 8.4+
Try deleting a bib record. If it works you're probably safe. When fresh Koha installation on 8.4 was failing, I naively installed on 8.0 elsewhere and copied the DB. It responded with 500 errors while deleting records. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #4 from Djalel CHEFROUR <djalel.chefrour@univ-soukahras.dz> --- (In reply to Saiful Amin from comment #3)
(In reply to Djalel CHEFROUR from comment #2)
Hopefully, I am on the safe side for future Koha releases that will support SQL 8.4+
Try deleting a bib record. If it works you're probably safe.
When fresh Koha installation on 8.4 was failing, I naively installed on 8.0 elsewhere and copied the DB. It responded with 500 errors while deleting records.
I just deleted a bib record (on my staging server with a config that is a carbon copy of the production one) to test this. It went well in the GUI and nothing weird in the logs (including mysql/error.log). I can even see a 200 in plack.log [18/Apr/2026:22:02:31 +0100] "POST /intranet/tools/batch_delete_records.pl HTTP/1.1" 200 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Depends on| |36466 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36466 [Bug 36466] Incorrect date value stored when "Published on" or "Expected on" are empty -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hammat.wele@inlibro.com, | |jonathan.druart@gmail.com --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- Hammat, please provide a fix ASAP. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|25.11 |unspecified Keywords| |roadmap_25_05, | |roadmap_25_11 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |bibliothek@th-wildau.de |ity.org | CC| |bibliothek@th-wildau.de -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #6 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 198732 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198732&action=edit Bug 42412: Fix Incorrect date error in db-revs when using MySQL In Bug 36466 db_revs/251200019.pl was introduced to update wrong date values (0000-00-00) with NULL. This can fail on MySQL as it is running with sql_mode NO_ZERO_DATE activated which does not allow to select or update date fields with values='0000-00-00'. This patch changes the update queries in db_revs/251200019.pl to use Installer::sanitize_zero_date on both columns. Test plan: As the test shall be done using MysQL and Mariadb start 2 ktds: MySQL) DB_IMAGE=mysql:8.0 ktd --proxy --name mysql8 up -d MariaDB) ktd --proxy --name maria up -d a) checkout a version prior 36466: git checkout v24.11.14-1 b) reset_all c) Connect to staff interface (mysql8-intra.localhost and maria-intra.localhost) d) Go to Serials and create a new subscription e) run the following to enter database client in each ktd shell: koha-mysql kohadev f-mysql) run the following commands to be allowed to change planneddate and publisheddate to '0000-00-00': SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; update serial set planneddate = '0000-00-00', publisheddate = '0000-00-00'; f-maria) update serial set planneddate = '0000-00-00', publisheddate = '0000-00-00'; g) verify via: select * from serial; h) checkout main via: git checkout main i-mysql) run updatedatabase Upgrade to 25.12.00.019 [09:35:55]: Bug 36466 - Fix the incorrect 0000-00-00 date in planneddate and publisheddate field ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do Incorrect date error in db-revs when using MySQL In 36466 db_revs/251200019.pl for column 'planneddate' at row 1 at /kohadevbox/koha/C4/Installer.pm line 818 i-maria) do not run updatedatabase yet j) apply patch k-mysql) run updatedatabase Upgrade to 25.12.00.019 [09:37:02]: Bug 36466 - Fix the incorrect 0000-00-00 date in planneddate and publisheddate field Incorrect date planneddate and publisheddate fixed ... -> is successful now k-maria) run updatedatabase l) verify via: select * from serial; -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Upgrade to 25.11.02.004 |Upgrade to 25.11.02.004 |with MySQL 8.4.7 (on ubuntu |using MySQL fails with |24.04.4) fails with |Exception: Incorrect DATE |Exception: Incorrect DATE |value: value: '0000-00-00' |value: value: '0000-00-00' | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |lucas@bywatersolutions.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #198732|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #7 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 199297 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199297&action=edit Bug 42412: Fix Incorrect date error in db-revs when using MySQL In Bug 36466 db_revs/251200019.pl was introduced to update wrong date values (0000-00-00) with NULL. This can fail on MySQL as it is running with sql_mode NO_ZERO_DATE activated which does not allow to select or update date fields with values='0000-00-00'. This patch changes the update queries in db_revs/251200019.pl to use Installer::sanitize_zero_date on both columns. Test plan: As the test shall be done using MysQL and Mariadb start 2 ktds: MySQL) DB_IMAGE=mysql:8.0 ktd --proxy --name mysql8 up -d MariaDB) ktd --proxy --name maria up -d a) checkout a version prior 36466: git checkout v24.11.14-1 b) reset_all c) Connect to staff interface (mysql8-intra.localhost and maria-intra.localhost) d) Go to Serials and create a new subscription e) run the following to enter database client in each ktd shell: koha-mysql kohadev f-mysql) run the following commands to be allowed to change planneddate and publisheddate to '0000-00-00': SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; update serial set planneddate = '0000-00-00', publisheddate = '0000-00-00'; f-maria) update serial set planneddate = '0000-00-00', publisheddate = '0000-00-00'; g) verify via: select * from serial; h) checkout main via: git checkout main i-mysql) run updatedatabase Upgrade to 25.12.00.019 [09:35:55]: Bug 36466 - Fix the incorrect 0000-00-00 date in planneddate and publisheddate field ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do Incorrect date error in db-revs when using MySQL In 36466 db_revs/251200019.pl for column 'planneddate' at row 1 at /kohadevbox/koha/C4/Installer.pm line 818 i-maria) do not run updatedatabase yet j) apply patch k-mysql) run updatedatabase Upgrade to 25.12.00.019 [09:37:02]: Bug 36466 - Fix the incorrect 0000-00-00 date in planneddate and publisheddate field Incorrect date planneddate and publisheddate fixed ... -> is successful now k-maria) run updatedatabase l) verify via: select * from serial; Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|roadmap_25_05, |rel_25_05_candidate, |roadmap_25_11 |rel_25_11_candidate -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |26.05.00 released in| | --- Comment #8 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Pushed to main for 26.05.00 Nice work! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Mona Panchaud <m+koha@mpan.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m+koha@mpan.ch --- Comment #9 from Mona Panchaud <m+koha@mpan.ch> --- Thank you for fixing this bug. Can you please also include it in the next release of 25.05? Because we ran into this bug when upgrading from 24.11 to 25.05. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|26.05.00 |26.05.00,25.11.05 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #10 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Bug 42412 depends on bug 36466, which changed state. Bug 36466 Summary: Incorrect date value stored when "Published on" or "Expected on" are empty https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36466 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #11 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Starting up ktd's using the following is not possible: MySQL) DB_IMAGE=mysql:8.0 ktd --proxy --name mysql8 up -d MariaDB) ktd --proxy --name maria up -d Could I please get some guidance on how to do it? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #12 from Jan Kissig <bibliothek@th-wildau.de> --- (In reply to Wainui Witika-Park from comment #11)
Starting up ktd's using the following is not possible:
MySQL) DB_IMAGE=mysql:8.0 ktd --proxy --name mysql8 up -d MariaDB) ktd --proxy --name maria up -d
Could I please get some guidance on how to do it?
This should be called before: ktd_proxy --start then the other two commands using --proxy --name 'somename' will work. To access the instances in browser: http://mysql8-intra.localhost http://maria-intra.localhost -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #13 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- (In reply to Jan Kissig from comment #12)
(In reply to Wainui Witika-Park from comment #11)
Starting up ktd's using the following is not possible:
MySQL) DB_IMAGE=mysql:8.0 ktd --proxy --name mysql8 up -d MariaDB) ktd --proxy --name maria up -d
Could I please get some guidance on how to do it?
This should be called before: ktd_proxy --start then the other two commands using --proxy --name 'somename' will work. To access the instances in browser: http://mysql8-intra.localhost http://maria-intra.localhost
Thank you!!! I was able to get further but am still unable to get both proxies working at the same time. I am unable to replicate the error. However, since the test plan is not specifically for 25.05, and has already been tested by others, I am happy to backport the patch to 25.05. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|26.05.00,25.11.05 |26.05.00,25.11.05,25.05.12 released in| | Status|Pushed to stable |Needs documenting --- Comment #14 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Applied to 25.05.x for 25.05.12 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #15 from Mona P. <m+koha@mpan.ch> ---
Applied to 25.05.x for 25.05.12
I tried today to update to 25.05 from 24.11 but I still ran into the same issue. It seems like 25.05.12 is not released yet, only 25.05.11: apt-cache policy koha-common | grep -E 'Installed|Candidate' Installed: 24.11.16-2 Candidate: 25.05.11-1 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42412 --- Comment #16 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- (In reply to Mona P. from comment #15)
Applied to 25.05.x for 25.05.12
I tried today to update to 25.05 from 24.11 but I still ran into the same issue. It seems like 25.05.12 is not released yet, only 25.05.11:
apt-cache policy koha-common | grep -E 'Installed|Candidate' Installed: 24.11.16-2 Candidate: 25.05.11-1
Hi Mona, Yes 25.05.12 has not been released yet, it will be released to the public by next week. Thanks, Wainui -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org