Bug 15053

Summary: sample_creator_data.sql now fails during a fresh install
Product: Koha Reporter: Kyle M Hall <kyle.m.hall>
Component: Installation and upgrade (web-based installer)Assignee: Kyle M Hall <kyle.m.hall>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: bgkriegel, gmcharlt, jonathan.druart, katrin.fischer, mtompset, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 15086    
Attachments: Bug 15053 - sample_creator_data.sql now fails during a fresh install
[SIGNED-OFF] Bug 15053 - sample_creator_data.sql now fails during a fresh install
Bug 15053: Followup for french file
Bug 15053: Fix fr-FR, ru-RU and uk-UK sample creator data
[SIGNED OFF] Bug 15053: sample_creator_data.sql now fails during a fresh install
[SIGNED OFF] Bug 15053: Fix fr-FR, ru-RU and uk-UK sample creator data
Bug 15053: sample_creator_data.sql now fails during a fresh install
Bug 15053: Fix fr-FR, ru-RU and uk-UK sample creator data

Description Kyle M Hall 2015-10-23 14:01:10 UTC
ERROR 1136 (21S01) at line 6: Column count doesn't match value count at row 1
Comment 1 Kyle M Hall 2015-10-23 14:12:17 UTC Comment hidden (obsolete)
Comment 2 Katrin Fischer 2015-10-26 14:30:46 UTC
*** Bug 15064 has been marked as a duplicate of this bug. ***
Comment 3 Bernardo Gonzalez Kriegel 2015-10-26 14:59:43 UTC Comment hidden (obsolete)
Comment 4 Bernardo Gonzalez Kriegel 2015-10-26 15:05:45 UTC Comment hidden (obsolete)
Comment 5 Mark Tompsett 2015-10-28 13:38:56 UTC
$ git grep -l labels_t
I think Russian and Ukrainian are broken as well.
Please submit follow ups for those, so I can just sign off everyone accordingly.
Comment 6 Bernardo Gonzalez Kriegel 2015-10-28 14:47:23 UTC Comment hidden (obsolete)
Comment 7 Bernardo Gonzalez Kriegel 2015-10-28 14:49:20 UTC
(In reply to M. Tompsett from comment #5)
> $ git grep -l labels_t
> I think Russian and Ukrainian are broken as well.
> Please submit follow ups for those, so I can just sign off everyone
> accordingly.

Uploaded some kind of fix for ru and uk
Comment 8 Mark Tompsett 2015-10-28 15:35:38 UTC
Comment on attachment 44125 [details] [review]
Bug 15053: Fix fr-FR, ru-RU and uk-UK sample creator data

Review of attachment 44125 [details] [review]:
-----------------------------------------------------------------

Same for both RU and UK files.

::: installer/data/mysql/ru-RU/optional/print_labels.sql
@@ -17,5 @@
> -LOCK TABLES `labels_conf` WRITE;
> -/*!40000 ALTER TABLE `labels_conf` DISABLE KEYS */;
> -INSERT INTO `labels_conf` 
> -(id,barcodetype,title,subtitle,itemtype,barcode,dewey,classification,subclass,itemcallnumber,author,issn,isbn,startlabel,
> -printingtype,formatstring,layoutname,guidebox,active,fonttype,ccode,callnum_split)

Why remove the fields list completely? It would have been good to keep updated.

@@ -21,5 @@
> -printingtype,formatstring,layoutname,guidebox,active,fonttype,ccode,callnum_split)
> -VALUES 
> -(5,'CODE39',2,0,3,0,0,0,0,4,1,0,0,1,'BIBBAR','библио-запись и штрих-код',1,1,NULL,NULL,NULL,NULL),
> -(6,'CODE39',2,0,0,0,0,3,4,0,1,0,3,1,'BAR','переменный',1,1,NULL,NULL,NULL,NULL),
> -(7,'CODE39',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,NULL,NULL,1,'PATCRD','Карточки идентификации посетителей',1,NULL,NULL,NULL,NULL,NULL);

This last one looks strange, but why not keep the strange data?
Comment 9 Bernardo Gonzalez Kriegel 2015-10-28 15:46:35 UTC
> Why remove the fields list completely? It would have been good to keep
> updated.
> 

Table names have changed.
Column names have changed.
There is a different number of columns now.
This is really old data
 
> This last one looks strange, but why not keep the strange data?

Because that data need to be fixed to be loaded.
I'm in other things right now, that's the reason I don't fix them in the first place, only french data in which I simply added a couple of columns.
Comment 10 Bernardo Gonzalez Kriegel 2015-10-28 15:49:37 UTC
> > -(5,'CODE39',2,0,3,0,0,0,0,4,1,0,0,1,'BIBBAR','библио-запись и штрих-код',1,1,NULL,NULL,NULL,NULL),
> > -(6,'CODE39',2,0,0,0,0,3,4,0,1,0,3,1,'BAR','переменный',1,1,NULL,NULL,NULL,NULL),
> > -(7,'CODE39',1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,2,NULL,NULL,1,'PATCRD','Карточки идентификации посетителей',1,NULL,NULL,NULL,NULL,NULL);

From this I only removed the last one, patron card data, 1 & 2 in my patch are equivalent to 5 & 6


(1,'CODE39',1,'BIBBAR','библио-запись и штрих-код',0,1,'TR',7,'POINT',0,'L','title, author, itemcallnumber', '<opt></opt>', 'Labels'),
(2,'CODE39',1,'BAR','переменный',0,1,'TR',3,'POINT',0,'L','','','Labels');
Comment 11 Mark Tompsett 2015-10-28 15:51:18 UTC
Wow... That error in comment #1 was hard to notice.
Comment 12 Mark Tompsett 2015-10-28 16:31:25 UTC
Any logic with printers_profile should be placed BEFORE the creators_layout and creators_templates logic in:

installer/data/mysql/de-DE/optional/sample_creator_data.sql
installer/data/mysql/en/optional/sample_creator_data.sql
installer/data/mysql/es-ES/optional/sample_creator_data.sql
installer/data/mysql/it-IT/necessari/sample_creator_data.sql
installer/data/mysql/nb-NO/2-Valgfritt/sample_creator_data.sql

to completely avoid errors.
Comment 13 Tomás Cohen Arazi 2015-10-29 15:26:14 UTC Comment hidden (obsolete)
Comment 14 Tomás Cohen Arazi 2015-10-29 15:27:15 UTC Comment hidden (obsolete)
Comment 15 Jonathan Druart 2015-10-29 16:02:04 UTC
What is this labels_templates table?
Comment 16 Bernardo Gonzalez Kriegel 2015-10-29 16:08:06 UTC
(In reply to Jonathan Druart from comment #15)
> What is this labels_templates table?

Old data for an old table I suppose, forget to change the comment
Comment 17 Mark Tompsett 2015-10-29 17:46:09 UTC
Please don't forget about comment #12. :)
Comment 18 Tomás Cohen Arazi 2015-10-29 18:24:07 UTC
(In reply to M. Tompsett from comment #17)
> Please don't forget about comment #12. :)

Do this patches introduce the problem you mention?
Comment 19 Mark Tompsett 2015-10-29 19:31:12 UTC
(In reply to Tomás Cohen Arazi from comment #18)
> (In reply to M. Tompsett from comment #17)
> > Please don't forget about comment #12. :)
> 
> Do this patches introduce the problem you mention?

These patches do correct the error in comment #1.
They do not introduce new errors, as far as I can tell.
But a:
truncate blah 1
truncate blah 2
truncate blah 3
source blah 4
where blah 1..3 = the creator_ tables and printers_profile
and where blah 4 is in a nice loop for each of the 8 files.
(I ignored pl-PL)
-- I believe this does have an error. I'll retest later to be sure.
But like comment #12 says, printers_profile stuff before the other stuff dealt with it. I suspect it is because cascading creates a printers_profile entry, but I didn't look closely.
Comment 20 Tomás Cohen Arazi 2015-10-29 19:41:58 UTC
(In reply to M. Tompsett from comment #19)
> (In reply to Tomás Cohen Arazi from comment #18)
> > (In reply to M. Tompsett from comment #17)
> > > Please don't forget about comment #12. :)
> > 
> > Do this patches introduce the problem you mention?
> 
> These patches do correct the error in comment #1.
> They do not introduce new errors, as far as I can tell.
> But a:
> truncate blah 1
> truncate blah 2
> truncate blah 3
> source blah 4
> where blah 1..3 = the creator_ tables and printers_profile
> and where blah 4 is in a nice loop for each of the 8 files.
> (I ignored pl-PL)
> -- I believe this does have an error. I'll retest later to be sure.
> But like comment #12 says, printers_profile stuff before the other stuff
> dealt with it. I suspect it is because cascading creates a printers_profile
> entry, but I didn't look closely.

Yes, please. Re-test and fill a bug if your suspicion is correct. 3.22 needs to be rock solid. As all Koha releases ;-) Thanks for taking the time to do this.
Comment 21 Mark Tompsett 2015-10-29 21:20:21 UTC
(In reply to Tomás Cohen Arazi from comment #20)
> Yes, please. Re-test and fill a bug if your suspicion is correct. 3.22 needs
> to be rock solid. As all Koha releases ;-) Thanks for taking the time to do
> this.

No errors thus far in the retest.
I'll file a bug to remove all warnings. :)
Comment 22 Jonathan Druart 2015-10-30 09:16:10 UTC
Second patch does not work:

mysql koha_empty < installer/data/mysql/fr-FR/2-Optionel/sample_labels.sql
ERROR 1136 (21S01) at line 15: Column count doesn't match value count at row 1

[koha@koha-qa:~/src (BZ15053) ✭]% mysql koha_empty < installer/data/mysql/ru-RU/optional/print_labels.sql
ERROR 1136 (21S01) at line 19: Column count doesn't match value count at row 1

[koha@koha-qa:~/src (BZ15053) ✭]% mysql koha_empty < installer/data/mysql/uk-UA/optional/print_labels.sql
ERROR 1136 (21S01) at line 21: Column count doesn't match value count at row 1
Comment 23 Bernardo Gonzalez Kriegel 2015-10-30 11:00:45 UTC
(In reply to Jonathan Druart from comment #22)
> Second patch does not work:
> 
> mysql koha_empty < installer/data/mysql/fr-FR/2-Optionel/sample_labels.sql
> ERROR 1136 (21S01) at line 15: Column count doesn't match value count at row
> 1
> 
> [koha@koha-qa:~/src (BZ15053) ✭]% mysql koha_empty <
> installer/data/mysql/ru-RU/optional/print_labels.sql
> ERROR 1136 (21S01) at line 19: Column count doesn't match value count at row
> 1
> 
> [koha@koha-qa:~/src (BZ15053) ✭]% mysql koha_empty <
> installer/data/mysql/uk-UA/optional/print_labels.sql
> ERROR 1136 (21S01) at line 21: Column count doesn't match value count at row
> 1

$ git log --oneline | head -4
81c151f Bug 15053: Fix fr-FR, ru-RU and uk-UK sample creator data
9dc6b80 Bug 15053: sample_creator_data.sql now fails during a fresh install
05d3770 Bug 11881: QA follow-up - rename class
5adb226 Bug 11881: Small improvements for Items available for reference

$ mysql koha_empty < kohastructure.sql
$ mysql koha_empty < ru-RU/optional/print_labels.sql
$ mysql koha_empty -e "delete from creator_layouts; delete from creator_templates; delete from printers_profile"
$ mysql koha_empty < uk-UA/optional/print_labels.sql                                   $ mysql koha_empty -e "delete from creator_layouts; delete from creator_templates; delete from printers_profile"
$ mysql koha_empty  < fr-FR/2-Optionel/sample_labels.sql                                      

Works for me
Comment 24 Jonathan Druart 2015-10-30 11:32:53 UTC
Created attachment 44195 [details] [review]
Bug 15053: sample_creator_data.sql now fails during a fresh install

ERROR 1136 (21S01) at line 6: Column count doesn't match value count at row 1

Test Plan:
1) Start fresh install
2) Install all test data
3) Note the SQL error
4) Apply this patch
5) Repeat steps 1 and 2
6) Note no error

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
All fixed files loads without problem.
No errors found
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 25 Jonathan Druart 2015-10-30 11:32:59 UTC
Created attachment 44196 [details] [review]
Bug 15053: Fix fr-FR, ru-RU and uk-UK sample creator data

Fixes other sample creators data

To test:
1 ) Apply the patch
2) Remove sample creator date
delete from creator_layouts; delete from creator_templates; delete from printers_profile
3) Load fr-FR/2-Optionel/sample_labels.sql
or ru-RU/optional/print_labels.sql
or uk-UA/optional/print_labels.sql

Without the patch this files can't be loaded
Test all of them

In case of ru and uk I removed a patron card layout

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 26 Jonathan Druart 2015-10-30 11:34:09 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #23)
> Works for me

OOpps! Sorry about that Bernardo, indeed it works well.
My koha_empty DB was not updated :-/
So again, my apologies.
Comment 27 Bernardo Gonzalez Kriegel 2015-10-30 11:54:41 UTC
(In reply to Jonathan Druart from comment #26)
> So again, my apologies.

No problem :)
Thank you for your work!!
Comment 28 Tomás Cohen Arazi 2015-10-30 13:05:30 UTC
Patches pushed to master.

Thanks Kyle and Bernardo!