[Catalyst] Dumb CDBI question

Steve Atkins steve at blighty.com
Tue Aug 30 17:54:41 CEST 2005


On Tue, Aug 30, 2005 at 12:12:31PM +0100, Toby Corkindale wrote:
> On Mon, Aug 29, 2005 at 04:44:15PM -0700, Philip Edelbrock wrote:
> > 
> > Ack!  Answered my own question by looking at CDBI::Generic.  There's 
> > "constraint" and "exclude".  E.g.:
> > 
> > # M/CDBI.pm
> > __PACKAGE__->config(
> >     dsn           => 'dbi:Pg:dbname=mydb',
> >     user          => 'apache',
> >     password      => '4321',
> >     constraint    => 'mytable',
> >     exclude       => 'mytable2',
> >     options       => { AutoCommit => 1},
> >     relationships => 1,
> >     additional_base_classes => [qw/Class::DBI::FromForm 
> > Class::DBI::AsForm/],
> > );
> > 
> > BTW- for Pg, I wonder why we can't just use the "oid" as the primary key 
> > when a user-defined one isn't available?
> 
> Because they intend to make "WITHOUT OIDS" the default for new tables, in
> future releases of PostgreSQL, perhaps?
> See http://www.postgresql.org/docs/8.0/static/datatype-oid.html

Also, oids are not guaranteed to be unique and most smart PG users are
already creating tables without OIDS, to avoid the problems that can
happen when the global OID counter wraps around.

A serial or bigserial field is the way to go for synthetic primary keys
on PG.

Cheers,
  Steve



More information about the Catalyst mailing list