[Dbix-class] Foreign key violation error

Brandon Black blblack at gmail.com
Fri Jul 13 12:35:14 GMT 2007


On 7/12/07, Ramprabhu Kaliaperumal <ramprabhu.kaliaperumal at oracle.com> wrote:
>
> Hi All
>
> I am getting a strange error while inserting the records to child table
> from master table object.
>
> I am using create_related() method to insert child table record, but
> still I am getting Foreign Key violation error.
> Error says there is no parent key available. Wondering how come this
> error when I am create_related method.
>
> Pasting the error here...
>
>
> DBD::ODBC::st execute failed: [unixODBC][TimesTen][TimesTen 7.0.1.0.0
> ODBC Driver][TimesTen]TT3001: Foreign key violation [CUSTOMER]: the row
> in child table RKALIAPE.CUSTOMERCONTACT has no key in the parent table
> RKALIAPE.CUSTOMER -- file "constr.c", lineno 2159, procedure
> "sbSmxCheckAllConstr()" (SQL-23000)(DBD: st_execute/SQLExecute err=-1)
> at /.../DBIx/Class/Storage/DBI.pm line 743.
> DBIx::Class::Relationship::Base::create_related(): Error executing
> 'INSERT INTO CustomerContact (customer_number, field_name, field_value)
> VALUES (?, ?, ?)': [unixODBC][TimesTen][TimesTen 7.0.1.0.0 ODBC
> Driver][TimesTen]TT3001: Foreign key violation [CUSTOMER]: the row in
> child table RKALIAPE.CUSTOMERCONTACT has no key in the parent table
> RKALIAPE.CUSTOMER -- file "constr.c", lineno 2159, procedure
> "sbSmxCheckAllConstr()" (SQL-23000)(DBD: st_execute/SQLExecute err=-1)
> at /..../Customer.pm line 63
>
> Thanks in advance.
>

We can't really tell what's going on without seeing the classes, the
create table statements, and the code.

-- Brandon



More information about the Dbix-class mailing list