Bug 8471 - loading an sql file into mysql, often fails when loading the 'letter' table
Summary: loading an sql file into mysql, often fails when loading the 'letter' table
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Database (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: Galen Charlton
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-19 06:08 UTC by Mason James
Modified: 2015-12-03 22:00 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mason James 2012-07-19 06:08:43 UTC
loading an sql file into mysql, often fails when loading the 'letter' table

i have no idea why. the quick-fix is to drop - then create the database


$ mysql koha_test < koha.sql
ERROR 1005 (HY000) at line 3237: Can't create table 'koha_test.letter' (errno: 150)


http://koha.1045719.n5.nabble.com/MySQL-Database-Restoring-Problem-from-3-4-x-to-3-8-0-td5710925.html
Comment 1 Mason James 2012-12-11 15:41:24 UTC
(In reply to comment #0)
> loading an sql file into mysql, often fails when loading the 'letter' table
> 
> i have no idea why. the quick-fix is to drop - then create the database
> 
> 
> $ mysql koha_test < koha.sql
> ERROR 1005 (HY000) at line 3237: Can't create table 'koha_test.letter'
> (errno: 150)
> 
> 
> http://koha.1045719.n5.nabble.com/MySQL-Database-Restoring-Problem-from-3-4-
> x-to-3-8-0-td5710925.html


hmmm, i bumped into this problem again... 

'show engine innodb status' hints that its a foreign-key problem?

------------------------
LATEST FOREIGN KEY ERROR
------------------------
121212  4:06:49 Error in foreign key constraint of table head/message_transports
:
there is no index in referenced table which would contain
the columns as the first columns, or the data types in the
referenced table do not match the ones in table. Constraint:
,
  CONSTRAINT "message_transports_ibfk_3" FOREIGN KEY ("letter_module", "letter_c
ode", "branchcode") REFERENCES "letter" ("module", "code", "branchcode") ON DELE
TE CASCADE ON UPDATE CASCADE
The index in the foreign key in table is "message_transports_ibfk_3"
See http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html
for correct foreign key definition.
Comment 2 Mason James 2012-12-12 05:33:21 UTC
> > loading an sql file into mysql, often fails when loading the 'letter' table
> > 
> > i have no idea why. the quick-fix is to drop - then create the database


just a little update...

it seems this error is triggered when a koha-3.6 .sql file is loaded into an existing koha-3.8 database


so, this is ok
 $ mysql koha < ./koha-3.6.sql
 $ mysql koha < ./koha-3.8.sql

but this fails
 $ mysql koha < ./koha-3.8.sql
 $ mysql koha < ./koha-3.6.sql


hope that helps someone :)
Comment 3 Mason James 2012-12-12 05:37:08 UTC
> just a little update...
> 
> it seems this error is triggered when a koha-3.6 .sql file is loaded into an
> existing koha-3.8 database


ahh, thats probably a koha 3.6 .sql file, or *earlier*
Comment 4 Jonathan Druart 2015-03-31 11:32:12 UTC
This is certainly not valid anymore.
Please reopen if I am wrong.