Bug 29973

Summary: SQL syntax error in Cataloging when accessing pages "Advanced editor" and "New record"
Product: Koha Reporter: Dave Hodgins <dhodgins>
Component: CatalogingAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: m.de.rooy
Version: 21.11   
Hardware: All   
OS: Linux   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30097
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Dave Hodgins 2022-01-28 21:26:54 UTC
Recently upgraded to 21.11.01 and the "Advanced editor" page https://chnc-koha-intra.domain/cgi-bin/koha/cataloguing/editor.pl now returns Error 500. The intranet-error.log reports the following SQL syntax error:

AH01215: {UNKNOWN}: DBI Exception: DBD::mysql::db selectall_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',servername' at line 3  at /usr/share/perl5/DBIx/Class/Schema.pm line 1118.: /usr/share/koha/intranet/cgi-bin/cataloguing/editor.pl

AH01215: \tDBIx::Class::Schema::throw_exception(Koha::Schema=HASH(0x561f387caed8), "DBI Exception: DBD::mysql::db selectall_arrayref failed: You "...) called at /usr/share/perl5/DBIx/Class/Storage.pm line 113: /usr/share/koha/intranet/cgi-bin/cataloguing/editor.pl

AH01215: \tDBIx::Class::Storage::throw_exception(DBIx::Class::Storage::DBI::mysql=HASH(0x561f389880d8), "DBI Exception: DBD::mysql::db selectall_arrayref failed: You "...) called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1501: /usr/share/koha/intranet/cgi-bin/cataloguing/editor.pl

AH01215: \tDBIx::Class::Storage::DBI::__ANON__("DBD::mysql::db selectall_arrayref failed: You have an error i"..., DBI::db=HASH(0x561f3a9a8f90), undef) called at /usr/share/koha/intranet/cgi-bin/cataloguing/editor.pl line 80: /usr/share/koha/intranet/cgi-bin/cataloguing/editor.pl

AH01215: : /usr/share/koha/intranet/cgi-bin/cataloguing/editor.pl

Koha 21.11.01.000
MySQL 8.0.27
Comment 1 Dave Hodgins 2022-01-31 16:59:51 UTC
The problem is in file /usr/share/koha/intranet/cgi-bin/cataloguing/editor.pl. You've got a hard coded SQL statement that uses the MySQL (as of version 8, anyway) reserved keyword "rank." Escaping that seems to fix the issue.
Comment 2 Katrin Fischer 2022-02-19 21:03:25 UTC
Raising severity for now to get some attention on this.
Comment 3 Katrin Fischer 2023-06-25 11:43:08 UTC
This was fixed by bug 33375.

*** This bug has been marked as a duplicate of bug 33375 ***