From: Dagfinn Ilmari Mannsåker Date: Tue, 27 Jan 2015 13:24:56 +0000 (+0000) Subject: Fix DB2 foreign-key introspection X-Git-Tag: 0.07043~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=208bdf790f56fad2b950be62c4336b0b6f9be6ca;hp=6f57f50ecc50f1d0961b26b1c2886ff05a5bb53a;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Fix DB2 foreign-key introspection The join to the referenced key columns was only using the constraint name, which is not necessarily unique. Also use the referenced table schema and name. --- diff --git a/Changes b/Changes index 7893b35..fe6a442 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader - Fix many_to_many bridges with overlapping foreign keys - Document how to add perltidy markers via filter_generated_code + - Fix DB2 foreign-key introspection 0.07042 2014-08-20 - Fix unescaped left braces in regexes in tests diff --git a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm index 5c1296a..45dabd3 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm @@ -104,6 +104,8 @@ JOIN syscat.references sr AND tc.tabname = sr.tabname JOIN syscat.keycoluse rkcu ON sr.refkeyname = rkcu.constname + AND sr.reftabschema = rkcu.tabschema + AND sr.reftabname = rkcu.tabname AND kcu.colseq = rkcu.colseq WHERE tc.tabschema = ? AND tc.tabname = ?