[Dbix-class] find_or_create problem with Pg: proposed patch

Nigel Metheringham nigel.metheringham at dev.intechnology.co.uk
Thu Apr 3 16:53:53 BST 2008


On 3 Apr 2008, at 16:30, Alex Povolotsky wrote:
> Attempt to insert into postgres table with undef's for columns with  
> default values yields an error. It is especially bad with  
> find_or_create sub.
>
> I've made and tested a simple patch, it looks working ok.


So the problem is that when you *explicitly* set column values to  
undef (NULL), DBIC does not magically put default values in place?

Adding that (and the patch only touches Pg - thus making Pg behave  
differently to all the other databases) appears like too much (or  
inappropriate) magic to me.

I'd be happier with something that generically puts default values in  
when the key/value to insert was missed out altogether, but in general  
I tend to let the DB do that.  At present it looks like default_value  
is used only by deploy.

	Nigel.
--
[ Nigel Metheringham             Nigel.Metheringham at InTechnology.com ]
[ - Comments in this message are my own and not ITO opinion/policy - ]




More information about the DBIx-Class mailing list