@@ -513,7 +513,7 @@ func (reference *ForeignKeyReferenceHandler) CheckReference(ctx *sql.Context, ro
513513 }
514514 if err == nil {
515515 // We have a parent row, but for DECIMAL types we need to be strict about precision/scale
516- if shouldReject := reference .validateDecimalMatch (ctx , row ); shouldReject {
516+ if shouldReject := reference .validateDecimalMatch (); shouldReject {
517517 return sql .ErrForeignKeyChildViolationMySQL845 .New (reference .ForeignKey .Database , reference .ForeignKey .Table ,
518518 reference .ForeignKey .Name , strings .Join (reference .ForeignKey .Columns , ", " ),
519519 reference .ForeignKey .ParentTable , strings .Join (reference .ForeignKey .ParentColumns , ", " ))
@@ -541,12 +541,11 @@ func (reference *ForeignKeyReferenceHandler) CheckReference(ctx *sql.Context, ro
541541 }
542542 }
543543
544- return sql .ErrForeignKeyChildViolation .New (reference .ForeignKey .Database , reference .ForeignKey .Table ,
545- reference .ForeignKey .Name , strings .Join (reference .ForeignKey .Columns , ", " ),
546- reference .ForeignKey .ParentTable , strings .Join (reference .ForeignKey .ParentColumns , ", " ))
544+ return sql .ErrForeignKeyChildViolation .New (reference .ForeignKey .Name , reference .ForeignKey .Table ,
545+ reference .ForeignKey .ParentTable , reference .RowMapper .GetKeyString (row ))
547546}
548547
549- func (reference * ForeignKeyReferenceHandler ) validateDecimalMatch (ctx * sql. Context , row sql. Row ) bool {
548+ func (reference * ForeignKeyReferenceHandler ) validateDecimalMatch () bool {
550549 if reference .RowMapper .Index == nil {
551550 return false
552551 }
@@ -622,7 +621,6 @@ func (mapper *ForeignKeyRowMapper) GetIter(ctx *sql.Context, row sql.Row, refChe
622621 }
623622
624623 targetType := mapper .SourceSch [rowPos ].Type
625-
626624 // Transform the type of the value in this row to the one in the other table for the index lookup, if necessary
627625 if mapper .TargetTypeConversions != nil && mapper .TargetTypeConversions [rowPos ] != nil {
628626 var err error
0 commit comments