On 12/5/06 6:49 PM, Clayton Scott wrote:
> CREATE TABLE club      (id serial PRIMARY KEY, name text);
> CREATE TABLE person  (id serial PRIMARY KEY, name text);
> CREATE TABLE position (id serial PRIMARY KEY, name text);
> 
> CREATE TABLE company_person_map (
>    club            integer not null REFERENCES club (id),
>    person_id    integer not null REFERENCES person (id),
>    position_id   integer not null REFERENCES position (id),
> );
> 
> When I use Loader to build my classes CompanyPersonMap.pm
> has all of the appropriate columns but only has the
> foreign keys for company and person.

It's a bug.  The table name "position" is a keyword in Postgres and ends up
coming back in the DBI foreign key info as qq("position").  I handle quoted
values in the internal refine_dbi_foreign_key_info() method, but I wasn't
handling UK_TABLE_NAME.  I've made the fix in my local copy, but I'm in the
middle of some Oracle changes and I'm not ready to check in to SVN yet.  To
fix it yourself, replace this method in Rose::DB:

sub refine_dbi_foreign_key_info
{
  my($self, $fk_info) = @_;
   
  foreach my $name (qw(NAME COLUMN_NAME DATA_TYPE TABLE_NAME
                      TABLE_CAT TABLE_SCHEM))
  {
    foreach my $prefix (qw(FK_ UK_))
    {
      my $param = $prefix . $name;
      $fk_info->{$param} = $self->unquote_column_name($fk_info->{$param})
        if(exists $fk_info->{$param});
    }
  }

  return;
}

-John



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to