Bug 17860 - [SQL strict mode] MARC records will stage, but Manage for import shows 'no data in table'
Summary: [SQL strict mode] MARC records will stage, but Manage for import shows 'no da...
Status: RESOLVED DUPLICATE of bug 20144
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Bibliographic record staging/import (show other bugs)
Version: unspecified
Hardware: PC Linux
: P1 - high normal (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 17258
  Show dependency treegraph
 
Reported: 2017-01-06 16:07 UTC by gale@rabbat.net
Modified: 2018-02-06 20:52 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
error log produced after attempt to stage and manage MARC records (302.68 KB, text/plain)
2017-01-07 22:33 UTC, gale@rabbat.net
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gale@rabbat.net 2017-01-06 16:07:11 UTC
I have no difficulty staging bibliographic or authority records, but using management, yields 'no data in table'. Have tried the files on demo systems and they work. Don't understand what the trouble is. Have deleted and reinstalled Koha, have dumped mysql data and recreated database.
Comment 1 gale@rabbat.net 2017-01-07 22:33:07 UTC
Created attachment 58653 [details]
error log produced after attempt to stage and manage MARC records
Comment 2 Jonathan Druart 2017-01-09 09:59:06 UTC
Hello,
The relevant message is "stage-marc-import.pl: DBD::mysql::st execute failed: Field 'marcxml_old' doesn't have a default value".

Indeed we have a sql query inserting a row in the import_records without specifying a value for this marcxml_old column (C4/ImportBatch.pm:1560 in _create_import_record).

Take a look at this entry on the wiki page to know how to fix this problem:
https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages#Ubuntu_16.04_and_MySQL_5.7
Comment 3 niko 2017-12-12 10:46:00 UTC
Hi there,
it seems that i have exactly the same problem here.
execute failed: Field 'marcxml_old' doesn't have a default value [for Statement "INSERT INTO import_records (import_batch_id, record_sequence, marc, marcxml, : /usr/share/koha/intranet/cgi-bin/tools/stage-marc-import.pl, referer: http://localhost:8080/cgi-bin/koha/tools/stage-marc-import.


I am using MariaDB and I am quite a newbie.
I am not able to locate the right file in MariaDB to add 

sql-mode="IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

nor I am sure it is necessary in MariaDB.
Can You give me a hint, please...
Comment 4 niko 2017-12-12 10:50:12 UTC
to be more specific about my test-Installation:
Ubuntu-16.04
Koha version: 	17.05.06.000
MySQL version: 	mysql Ver 15.1 Distrib 10.2.11-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Comment 5 niko 2017-12-12 11:10:19 UTC
found it:
/etc/mysql/conf.d/mariadb.cnf
restarted the mysq-server.

now it works.

the documentation here implies that this problem is not present with MariaDB.
This seems to be wrong!?
Comment 6 Jonathan Druart 2017-12-12 13:45:40 UTC
(In reply to niko from comment #5)
> found it:
> /etc/mysql/conf.d/mariadb.cnf
> restarted the mysq-server.
> 
> now it works.
> 
> the documentation here implies that this problem is not present with MariaDB.
> This seems to be wrong!?

Indeed, https://mariadb.com/kb/en/library/sql-mode/:
"""
Since MariaDB 10.2.4, SQL_MODE is by default set to NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO. In earlier versions of MariaDB 10.2, and since MariaDB 10.1.7, SQL_MODE is by default set to NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER. For earlier versions of MariaDB 10.1, and MariaDB 10.0 and before, no default is set.
"""
Comment 7 Jonathan Druart 2018-02-06 20:52:56 UTC
Will be fixed by bug 20144

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