[Dbix-class] bug with find_or_new and update_or_insert, for postgres DB

Jess Robinson castaway at desert-island.me.uk
Tue Jan 8 17:08:06 GMT 2008


On Tue, 8 Jan 2008, Erik Colson wrote:

> Erik Colson wrote:
>> does this mean it is possible to do such a thing :
>>
>>     $newrecord = $rs->new({id=>DEFAULT}) ;
>> 
>> and then
>>
>>     $newrecord->insert ;
>> 
>> would autoincrement id if id is defined as a primary key autoincrement ?
>> 
>
> Hate replying to myself ...
> but this seems to work with sqlite3
>
>   $newrecord = $rs->new({}) ;
>   $newrecord->insert ;
>
> would this work for all database backends available in DBIx::Class ?
>

No, cos some insist that you pass DEFAULT to get the default value, 
passing nothing is an error.

Yes, not all databases work the same. Yes, this is bloody annoying.

It wouldnt be a bad idea for the various Storage::DBI subclasses to 
standardise this..

Jess



More information about the DBIx-Class mailing list