[CDBI] Working with tables without primary keys?

Matt S Trout dbix-class at trout.me.uk
Tue Nov 8 17:09:49 GMT 2005

On Tue, Nov 08, 2005 at 10:50:43AM -0600, Eamon Daly wrote:
> I didn't realize that 'All' makes the left-hand item the PK.
> My hack was to define all columns as the PK, which seems to
> get me where I want to go. To answer the question "why?",
> though, I would think this is a pretty common technique:
> package Test::Action;
> __PACKAGE__->columns(Primary => qw/person_id action/);
> package Test::Person;
> __PACKAGE__->columns(All => qw/person_id person_name/);

That's just a two-column primary key though - not a table without a
primary key. The fact that you haven't yet required a column on Action
that isn't part of the PK (e.g. time_happened) doesn't mean you don't
have one at all.

     Matt S Trout       Specialists in Perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

More information about the ClassDBI mailing list