Subject: | New error in 0.082842 with primary key that lacks auto_increment |
After upgrading to 0.082842 I see a lot of errors (on basically any 'insert' operation) like: "DBIx::Class::Storage::DBI::insert(): Missing value for primary key column 'id' on <table name> - perhaps you forgot to set its 'is_auto_increment' attribute during add_columns()? Treating 'id' implicitly as an autoinc, and attemptingvalue retrieval".
I define my primary keys like this in sql (postgres 10):
create table foo (
id uuid default public.gen_random_uuid() not null,
...,
);
and like this in the result class:
__PACKAGE__->add_columns(
"id",
{
data_type => "uuid",
default_value => \"gen_random_uuid()",
is_nullable => 0,
size => 16,
},
...,
);
Therefore, for any row being ->inserted, I do not supply the id field, instead expecting it to be populated db-side and included on retrieval.
Looking at the Changes file, there are a few fixes mentioned that relate to primary keys and auto_increment. Commit 03852844a3e looks especially relevant. The newly-carping code should also be checking if a non-supplied PK has a defined 'default'.