Class::DBI::FromCGI and ignore_columns

[prev] [thread] [next] [Date index for 2004/07/07]

From: Dana Hudes
Subject: Class::DBI::FromCGI and ignore_columns
Date: 15:05 on 07 Jul 2004
I am trying to use Class::DBI::FromCGI . My database is Postgresql 7.3.4 .
Perl 5.8.1 ; Class::DBI 0.96 ; CDBI::FromCGI 0.94 , DBD::Pg 1.32 . All on 
SuSE Linux 9.0.
The primary key of the table in which I am trying to add a row is a 
'serial' . The database has it as type integer with modifiers 
not null and default value is to take the next number from the sequence.

I have setup a class method for each of my tables to provide a list of 
columns to ignore and  I have verified that CDBI::FromCGI does get the 
cols_to_ignore . I invoke CDBI::FromCGI with
$class->create_from_cgi($h => { ignore => \@cols_to_ignore }

the content of @cols_to_ignore in this case is 'category_id'
but nonetheless $class->create() gets called with column 'category_id' and 
an undef value. This in turn blows up in DBD::Pg with "Fail to add null 
value in not null attribute category_id".

If I call $class->sequence(category_id) then the create will fail when it 
tries to SELECT NEXTVAL(category_id) .

Class::DBI::FromCGI and ignore_columns
Dana Hudes 15:05 on 07 Jul 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52