[Koha] foreign key constraint fails when importing csv

Galen Charlton galen.charlton at liblime.com
Fri Jan 30 07:34:54 NZDT 2009


Hi,

On Thu, Jan 29, 2009 at 1:05 PM, Marty <ontariowolf64 at yahoo.com> wrote:
> Me again.
> Trying to get borrowers from old koha to koah 3 I get this error message;
>
> mysql> LOAD DATA INFILE "/home/marty/patronz.csv" INTO TABLE borrowers FIELDS TERMINATED BY ',' ENCLOSED BY "";
>
> ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`koha/borrowers`, CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`))
>
> Not sure about this foreign key constraint, did I fail to set some value in Koha?

This means that there are patron categories in your data that are not
defined in administration, and thus not present in the categories
table.  Check your data and make sure that all of the patron category
codes that you use are defined.

Regards,

Galen
-
Galen Charlton
VP, Research & Development, LibLime
galen.charlton at liblime.com
p: 1-888-564-2457 x709
skype: gmcharlt


More information about the Koha mailing list