Subject: | Redundant foreign key entries from Table::foreign_keys_by_table |
The result of Table::foreign_keys_by_table can contain foreign keys twice.
The attached patch has the same "seen"-functionality as Table::all_foreign_keys.
=== Table.pm
==================================================================
--- Table.pm (revision 6)
+++ Table.pm (local)
@@ -164,11 +164,17 @@
my $fk = $self->{fk};
my @fk;
+ my %seen;
if ( exists $fk->{$name} )
{
foreach my $c ( keys %{ $fk->{$name} } )
{
- push @fk, @{ $fk->{$name}{$c} };
+ foreach my $key ( @{ $fk->{$name}{$c} } )
+ {
+ next if $seen{$key};
+ push @fk, $key;
+ $seen{$key} = 1;
+ }
}
}