[Dbix-class] Bug? Failing test case for joining on default values

Zbigniew Lukasiak zzbbyy at gmail.com
Tue Nov 18 20:27:48 GMT 2008


On Tue, Nov 18, 2008 at 9:19 PM, J. Shirley <jshirley at gmail.com> wrote:
> On Tue, Nov 18, 2008 at 12:00 PM, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
>> On Tue, Nov 18, 2008 at 6:16 PM, J. Shirley <jshirley at gmail.com> wrote:
> [snip]
>> This is again the recursion in insert (see my email about backcompat
>> and recursive insert).  I've tried this with my patch - but this time
>> I've changed the create method to run the non-recursive version of
>> insert and 5 of your tests passed.
>>
>
> I don't think that is right.
>

Ah - yeah you are right.

Sorry.


> There were 6 tests, and only one failed.  The error is the one that
> fails (test #3) :)
>
> The problem is:
> # Column name not loaded on DBICTest::DefaultJoin=HASH(0xa7d804)
> trying to resolve relationship at lib/DBIx/Class/Schema.pm line 968
>
> The core issue is quite simple.  This is because a single insert
> doesn't fetch the column info from default values.
>
> Assuming Foo has a column 'name' with a default_value.
>
> my $obj = $schema->resultset('Foo')->create({ bar => 'baz' });
> $obj->name; # undef
>
> If something has default values, you have to do a discard_changes to
> get all the data.  I thought it was only in relationships, but it
> isn't.
>
> -J
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/



More information about the DBIx-Class mailing list