@@ -513,7 +513,7 @@ func (reference *ForeignKeyReferenceHandler) CheckReference(ctx *sql.Context, ro
513
513
}
514
514
if err == nil {
515
515
// 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 {
517
517
return sql .ErrForeignKeyChildViolationMySQL845 .New (reference .ForeignKey .Database , reference .ForeignKey .Table ,
518
518
reference .ForeignKey .Name , strings .Join (reference .ForeignKey .Columns , ", " ),
519
519
reference .ForeignKey .ParentTable , strings .Join (reference .ForeignKey .ParentColumns , ", " ))
@@ -541,12 +541,11 @@ func (reference *ForeignKeyReferenceHandler) CheckReference(ctx *sql.Context, ro
541
541
}
542
542
}
543
543
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 ))
547
546
}
548
547
549
- func (reference * ForeignKeyReferenceHandler ) validateDecimalMatch (ctx * sql. Context , row sql. Row ) bool {
548
+ func (reference * ForeignKeyReferenceHandler ) validateDecimalMatch () bool {
550
549
if reference .RowMapper .Index == nil {
551
550
return false
552
551
}
@@ -622,7 +621,6 @@ func (mapper *ForeignKeyRowMapper) GetIter(ctx *sql.Context, row sql.Row, refChe
622
621
}
623
622
624
623
targetType := mapper .SourceSch [rowPos ].Type
625
-
626
624
// Transform the type of the value in this row to the one in the other table for the index lookup, if necessary
627
625
if mapper .TargetTypeConversions != nil && mapper .TargetTypeConversions [rowPos ] != nil {
628
626
var err error
0 commit comments