[Catalyst] How to update row in Postgres when SERIAL PRIMARY KEY?

Jesper Krogh jesper at krogh.cc
Tue Jul 4 20:14:06 CEST 2006


Dennis Daupert wrote:
> I know how in mysql, but still new to postgresql, trying to learn. In
> mysql, when there's an autoincremented integer primary key, you don't
> mention that field on inserts; it just gets handled. In postgresql,
> when I try that, he complains. Also complains if I try to set id to
> '', 'undef', 'DEFAULT', and various other tries.

Dont mention it.. that "just works". SERIAL get expanded to a sequence and

int id DEFAULT nextval("sequence")

> $c->stash->{quote} = $c->model('CatapultDB::Quotes')->create({ id =>
> 'DEFAULT', quote  => $c->request->params->{quote}, author =>
> $c->request->params->{author}, category =>
> $c->request->params->{category}, active => 'true' });

There is actually a specific DBIx::Class mailinglist.

Jesper
-- 
Jesper Krogh, jesper at krogh.cc




More information about the Catalyst mailing list