Subject: | Table with ID column not as primary key causes update not insert |
Running on "Linux dagobar 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST
2008 x86_64 x86_64 x86_64 GNU/Linux"
Perl version 5.12.0
We have a legacy table that contains a column "ID" as a non-primary key
column. When using HTML::FormHandler's process() function under Catalyst
to create a new row in this table by passing item_id as undef, if the
value in the "ID" form field happens to match a value in the primary key
column, the row is updated rather than a new record inserted as exepected.
# Validate and insert database
return unless $self->form->process(
item_id => undef,
params => $c->req->parameters,
schema => $c->model('ConfigDB')->schema,
);
It looks like there may be an assumption that a column called "ID" will
be the primary key?