On Mon, Feb 25, 2008 at 11:53:19PM +0300, Alex Povolotsky wrote: > Hello! > > I've found in archives nearly my case, that passing NULL to Pg is not > 'not passing column at all', so adding a new row with a simple code like > this > > my $loc = $c->model($self->model_name)->find_or_new({lid => $id});
Change this to : my $model = $c->model($self->model_name); my $loc = defined $id ? $model->find({lid => $id}) : $model->new({}); find_or_new should be used for "I have a unique key but I don't know if it already exists". if you know you -don't- have a key, just call new() straight off. > if ($form->submitted && $form->validate) { > # Fill in > data > > $loc->name($form->field('name')); > $loc->descr($form->field('descr')); > $loc->update_or_insert(); > $c->req->redirect($c->uri_for('list')); > } This will work now. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/ _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]