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

Jess Robinson castaway at desert-island.me.uk
Sat Apr 5 12:13:23 BST 2008



On Sat, 5 Apr 2008, Alex Povolotsky wrote:

> Jess Robinson wrote:
>> 
>> 
>> On Thu, 3 Apr 2008, Alex Povolotsky wrote:
>> 
>>> Hello!
>>> 
>>> 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.
>> 
>> Are those columns also nullable, or not? If they're not, inserting 
>> null/undef doesn't make sense.. In DBIx::Class or plain SQL. the solution 
>> is generally to insert \'DEFAULT' ..
>
> Well, how do you pass DEFAULT (not 'DEFAULT' string, but DEFAULT SQL keyword) 
> to DBI?
>

Using a literal string like that:

{ mycol => \'DEFAULT' }

Jess



More information about the DBIx-Class mailing list