Skip Menu |

This queue is for tickets about the DBIx-Class-Schema-Loader CPAN distribution.

Report information
The Basics
Id: 19164
Status: resolved
Worked: 15 min
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: blblack [...] gmail.com
Requestors: bkw [...] weisshuhn.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.02007
Fixed in:
  • 0.03000
  • 0.03001
  • 0.03002
  • 0.03003



Subject: cross-schema foreign keys not supported (Pg)
Foreign keys across database schemas break the loading of relationships. Example in Pg: SQL: ==== CREATE SCHEMA foo; CREATE SCHEMA bar; CREATE TABLE foo.main (id integer PRIMARY KEY); CREATE TABLE bar.baz (fk_foo integer REFERENCES foo.main(id)); Perl: ===== DBIx::Class::Schema::Loader->load_from_connection( connect_info => ['dbi:Pg:dbname=demo' ... ], relationships => 1, debug => 1, db_schema => 'bar' ); Result: ======= ### START DBIx::Class::Schema::Loader dump ### # Initializing table "baz" as "DBIx::Class::Schema::Loader::Baz" baz has no primary key at /usr/lib/perl5/vendor_perl/5.8.6/DBIx/Class/Schema/Loader.pm line 145 DBIx::Class::Schema::Loader::Baz->table('baz'); DBIx::Class::Schema::Loader::Baz->add_columns('fk_foo') Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/DBD/Pg.pm line 800. DBD::Pg is version 1.49. The culprit is line 461 in DBIx/Class/Schema/Loader/Generic.pm, in function _load_relationships. The call to foreign_key_info specifies the db_schema for PKTABLE_SCHEM, only looking within db_schema.
On Tue May 09 11:19:29 2006, guest wrote: Show quoted text
> Foreign keys across database schemas break the loading of relationships.
All of the related code is going through a major upheaval in the development series at the moment. I'll look at this RSN, before the dev release series is done with.
Fixed in the 0.03 series of releases which are now available on CPAN. By "Fixed" what I mean is that it no longer barfs and dies on cross-schema FKs, but instead merely ignores them. Other users have been asking for multi-schema support, which would imply properly loading cross-schema FKs, but I consider this more a future feature than a part of this (or any) bug.