Skip Menu |
 

This queue is for tickets about the Alzabo CPAN distribution.

Maintainer(s)' notes

Not really maintained any more. Interested in taking it over? Email the author.

Report information
The Basics
Id: 13885
Status: resolved
Priority: 0/
Queue: Alzabo

People
Owner: Nobody in particular
Requestors: Rainer.Rohmfeld [...] emuge.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.87
Fixed in: 0.88

Attachments


Subject: Redundant foreign key entries from Table::foreign_keys_by_table
Download (untitled) / with headers
text/plain 157b
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.
Download Table.pm.patch
text/x-diff 524b
=== 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; + } } }
Date: Wed, 27 Jul 2005 09:38:55 -0500 (CDT)
From: Dave Rolsky <autarch [...] urth.org>
To: Guest via RT <bug-Alzabo [...] rt.cpan.org>
Subject: Re: [cpan #13885] Redundant foreign key entries from Table::foreign_keys_by_table
RT-Send-Cc:
Download (untitled) / with headers
text/plain 457b
On Wed, 27 Jul 2005, Guest via RT wrote: Show quoted text
> 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.
Do you have a test case for this? -dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/
Download (untitled) / with headers
text/plain 1.1k
[autarch@urth.org - Wed Jul 27 10:39:09 2005]: Show quoted text
> Do you have a test case for this? > > > -dave >
The problem occurs with multi column foreign keys, for example CREATE TABLE `TAWerkstoffText` ( `landID` varchar(3) NOT NULL default '', `wkstextID` int(11) NOT NULL default '0', `text` text NOT NULL, PRIMARY KEY (`landID`,`wkstextID`), KEY `IX_tfRS30` (`landID`), CONSTRAINT `TAWerkstoffText_ibfk_1` FOREIGN KEY (`landID`) REFERENCES `ALand` (`landID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `rTAWerkstoffATyp` ( `atypID` int(11) NOT NULL default '0', `landID` varchar(3) NOT NULL default '', `wkstextID` int(11) NOT NULL default '0', `normID` int(11) NOT NULL default '0', `wksNrID` int(11) NOT NULL default '0', `textID` int(11) NOT NULL default '0', PRIMARY KEY (`atypID`,`landID`,`wkstextID`,`normID`,`wksNrID`), CONSTRAINT `rTAWerkstoffATyp_ibfk_5` FOREIGN KEY (`landID`,`wkstextID`) REFERENCES `TAWerkstoffText` (`landID`, `wkstextID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; If we run 'foreign_keys_by_table' from rTAWerkstoffATyp to TAWerkstoffText, the result is a 2-element array with the same foreign key
From: Rainer.Rohmfeld [...] emuge.de
Download (untitled) / with headers
text/plain 129b
[guest - Wed Jul 27 11:23:20 2005]: For simplicity all other foreign keys have been deleted from the DDL of rTAWerkstoffATyp


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.