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

J. Shirley jshirley at gmail.com
Tue Nov 18 20:19:57 GMT 2008


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.

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



More information about the DBIx-Class mailing list