From: Rafael Kitover Date: Tue, 8 May 2012 15:30:45 +0000 (-0400) Subject: work around broken kseq in Pg fk info (RT#77062) X-Git-Tag: 0.07024~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=79137580d6250b5d9ae4e44506d5cb30033f5d20;p=dbsrgits%2FDBIx-Class-Schema-Loader.git work around broken kseq in Pg fk info (RT#77062) The keyseqs from $dbh->foreign_key_info from DBD::Pg were erroneously high, and since they are used as an array index, they were causing the fk_info to return undefs and break everything. Add a grep defined, to the column arrays in fk_info which fixes everything. --- diff --git a/Changes b/Changes index ae8cf6e..0c773db 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - work around broken keyseq in DBD::Pg foreign_key_info (RT#77062) + 0.07023 2012-05-05 11:44:15 - properly order FK columns when using base ::DBI loader (SineSwiper) - bump Class::Inspector dep to 1.27 due to test failures with earlier diff --git a/lib/DBIx/Class/Schema/Loader/DBI.pm b/lib/DBIx/Class/Schema/Loader/DBI.pm index ce4a55b..03e48e0 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI.pm @@ -435,8 +435,8 @@ sub _table_fk_info { my @rels; foreach my $relid (keys %rels) { push(@rels, { - remote_columns => $rels{$relid}{rcols}, - local_columns => $rels{$relid}{lcols}, + remote_columns => [ grep defined, @{ $rels{$relid}{rcols} } ], + local_columns => [ grep defined, @{ $rels{$relid}{lcols} } ], remote_table => $rels{$relid}->{tbl}, }); }