Version 761 (latest in FreeBSD ports) RDBO::Loader
chooses the wrong primary key for this PostgreSQL
table:
db => \d Ratings
Table "public.ratings"
Column | Type | Modifiers
-------------+---------+-----------
userid | integer | not null
year | integer | not null
makeid | integer | not null
modelid | integer | not null
value | integer | not null
perf | integer | not null
reliability | integer | not null
comfort | integer | not null
style | integer | not null
overall | integer | not null
Indexes:
"ratings_pkey" PRIMARY KEY, btree (userid, "year",
makeid, modelid)
Foreign-key constraints:
"ratings_makeid_fkey" FOREIGN KEY (makeid)
REFERENCES makes(id)
"ratings_modelid_fkey" FOREIGN KEY (modelid)
REFERENCES models(id)
"ratings_userid_fkey" FOREIGN KEY (userid)
REFERENCES users(id)
The output from meta->perl_class_definition shows that
it's picking "reliability" as the primary key, instead
of the proper "userid", "year", "makeid", and
"modelid" columns:
package KH::RDBO::Rating;
use strict;
use base qw(KH::RDBO::DB::Object::AutoBase1);
__PACKAGE__->meta->setup
(
table => 'ratings',
columns =>
[
userid => { type => 'integer', not_null => 1
},
year => { type => 'integer', not_null => 1
},
makeid => { type => 'integer', not_null => 1
},
modelid => { type => 'integer', not_null => 1
},
value => { type => 'integer', not_null => 1
},
perf => { type => 'integer', not_null => 1
},
reliability => { type => 'integer', not_null => 1
},
comfort => { type => 'integer', not_null => 1
},
style => { type => 'integer', not_null => 1
},
overall => { type => 'integer', not_null => 1
},
],
primary_key_columns => [ 'reliability' ],
unique_key => [ 'userid', 'year', 'makeid',
'modelid' ],
foreign_keys =>
[
make =>
{
class => 'KH::RDBO::Make',
key_columns => { makeid => 'id' },
},
model =>
{
class => 'KH::RDBO::Model',
key_columns => { modelid => 'id' },
},
user =>
{
class => 'KH::RDBO::User',
key_columns => { userid => 'id' },
},
],
);
1;
Any clues?
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object