[Dbix-class] Re: DBIx::Class::ResultSet::RecursiveUpdate - announcement and RFC

Matt S Trout dbix-class at trout.me.uk
Tue Sep 30 13:20:13 BST 2008


On Tue, Sep 30, 2008 at 09:28:50AM +0200, Zbigniew Lukasiak wrote:
> The tricky part is when you load data from the form into the new row.
> You need to delete the pk from it - because otherwise at
> update_or_insert time it would issue an insert with pk = NULL - and
> this will fail in Pg (for example).  The point is that you cannot feed
> the same data to the find and to the insert calls - but
> update_or_create does that - and why it does not have much choice is
> another very long story.

Well, yes. If you have an auto-increment PK and you don't have a value for
it, then

(1) there's no form field in the first place, so that's not an issue

(2) you know you can't possibly find anything, so you wouldn't call
update_or_create, you'd just call create

I presume this is what Oliver's doing, which is why his code works.

Nothing tricky at all.

FormFu didn't used to do this, but Carl Franks agreed with me that this
was a bug in FormFu. If your code still has this bug, I suggest you fix it.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list