Bug 6993

Summary: Incorrect data type in auth_subfield_structure
Product: Koha Reporter: Chris Nighswonger <cnighswonger>
Component: DatabaseAssignee: Galen Charlton <gmcharlt>
Status: RESOLVED DUPLICATE QA Contact: Bugs List <koha-bugs>
Severity: minor    
Priority: P5 - low CC: jonathan.druart, paul.poulain, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 17258    

Description Chris Nighswonger 2011-10-09 20:15:00 UTC
kohastructure.sql makes auth_subfield_structure.linkid a tinyint(1) NOT NULL, but then authorities_normal_marc21.sql tries to insert an null string value for that field.

From kohastructure.sql:

DROP TABLE IF EXISTS `auth_subfield_structure`;
CREATE TABLE `auth_subfield_structure` (

...

  `linkid` tinyint(1) NOT NULL default 0,

...

From authorities_normal_marc21.sql :

INSERT INTO `auth_subfield_structure` (`authtypecode`, `tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `tab`, `authorised_value`, `value_builder`, `seealso`, `isurl`, `hidden`, `linkid`, `kohafield`, `frameworkcode`) VALUES
		('', '000', '@', 'fixed length control field', 'fixed length control field', 0, 1, 0, NULL, 'marc21_leader_authorities.pl', NULL, 0, 0, '', '', '')

...
Comment 1 Paul Poulain 2011-10-26 14:45:12 UTC
Bug still valid in 3.6
I think the NOT NULL is not necessary, so I propose we change to NULL
Comment 2 Owen Leonard 2014-07-10 17:32:35 UTC
The files described here appear to remain unchanged from when this bug was reported but obviously there are not critical consequences since the bug has not been touched in years. 

Is this bug really valid? If so, is it really a critical bug?
Comment 3 Jonathan Druart 2015-03-26 16:13:45 UTC
For information:

MariaDB [koha]> INSERT INTO `auth_subfield_structure` (`authtypecode`, `tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `tab`, `authorised_value`, `value_builder`, `seealso`, `isu
rl`, `hidden`, `linkid`, `kohafield`, `frameworkcode`) VALUES
    -> ('', '000', '@', 'fixed length control field', 'fixed length control field', 0, 1, 0, NULL, 'marc21_leader_authorities.pl', NULL, 0, 0, '', '', '');         
Query OK, 1 row affected, 1 warning (0.08 sec)

MariaDB [koha]> show warnings;
+---------+------+----------------------------------------------------------+
| Level   | Code | Message                                                  |
+---------+------+----------------------------------------------------------+
| Warning | 1366 | Incorrect integer value: '' for column 'linkid' at row 1 |
+---------+------+----------------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [koha]> select linkid from auth_subfield_structure where tagfield='000';
+--------+
| linkid |
+--------+
|      0 |
+--------+
1 row in set (0.00 sec)
Comment 4 Jonathan Druart 2015-03-26 16:14:46 UTC
Not critical at all, considered as minor. Feel free to change it if you disagree.
Comment 5 Jonathan Druart 2019-06-19 15:15:07 UTC

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