Re: column default values in v0.96

[prev] [thread] [next] [Date index for 2004/05/12]

From: Bart Lateur
Subject: Re: column default values in v0.96
Date: 11:27 on 12 May 2004
On Tue, 11 May 2004 21:27:59 +0100 (BST), ed-cdbi@xxxxxxxx.xxx wrote:

>We just upgraded to v0.96 from v0.95 and now inserts which relied on column defaults are failing with a
>
>     ORA-01400: cannot insert NULL into ("MYTABLE"."MYCOLUMN")
>
>It appears that undefs are being bound to the insert statement. 

I haven't even looked at Class::DBI 0.96 yet, but the error message
points to use of a different SQL statement to do the insert.

To explicitly set column col3, it ought to be doing 

	INSERT INTO mytable (col1, col2, col3) VALUES (?, ?, ?)

with placeholder values $col1, $col2 and $col3.

To use the default for col3, it ought to be doing this instead:

	INSERT INTO mytable (col1, col2) VALUES (?, ?)

with placeholder values $col1, $col2.

The former will fail with the above error message if $col3 is undef and
$col3 doesn't accept NULL values.

Redux to Class:DBI: it smells like col3 is listed among the "dirty"
column values, with undef as its value. The question is: why?

        -- 
        	Bart.

column default values in v0.96
ed-cdbi 20:27 on 11 May 2004

Re: column default values in v0.96
Tony Bowden 06:17 on 12 May 2004

Re: column default values in v0.96
Bart Lateur 11:27 on 12 May 2004

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