Subject: | Problem "Result collapse not possible - selection from a has_many source redirected to the main" after update 0.08196-3 => 0.08250-1 |
Date: | Tue, 24 Sep 2013 10:58:42 +0600 |
To: | bug-DBIx-Class [...] rt.cpan.org |
From: | Ivan Korjavin <korjavin [...] gmail.com> |
Schema is:
CREATE TABLE providers (
pid integer primary key autoincrement,
name varchar(50),
);
CREATE TABLE orders (
oid integer primary key autoincrement,
pid integer references providers (pid),
);
CREATE TABLE orderstatus(
osid integer primary key autoincrement,
oid integer references orders (oid),
regdt timestamp default current_timestamp
);
Code is:
my $order = $schema->resultset('Order');
my $r = $order->search(
{ 'orderstatuses.sid' => 1,
'orderstatuses.regdt' => { '>=', $first }
},
{ prefetch=>'pid',join => 'orderstatuses','+select'=>
'orderstatuses.regdt', '+as' => 'regdt', order_by => { -desc => 'me.oid' }
}
);
DBIC_TRACE=1 show the query:
SELECT me.oid, me.pid, orderstatuses.regdt, pid.pid, pid.name
FROM orders me LEFT JOIN orderstatus orderstatuses ON orderstatuses.oid =
me.oid LEFT JOIN providers pid ON pid.pid = me.pid WHERE ( (
orderstatuses.regdt >= ? AND orderstatuses.sid = ? ) ) ORDER BY me.oid DESC
Its works nice with libdbix-class-perl = 0.08196-3 but
in libdbix-class-perl = 0.08250-1
show the error:
Result collapse not possible - selection from a has_many source redirected
to the main object at /usr/share/perl5/DBIx/Class/Schema.pm line 1080.
DBIx::Class::Schema::throw_exception('a::Model=HASH(0x1931de0)', 'Result
collapse not possible - selection from a has_many sour...') called at
/usr/share/perl5/DBIx/Class/ResultSource.pm line 1952
DBIx::Class::ResultSource::throw_exception('DBIx::Class::ResultSource::Table=HASH(0x193b958)',
'Result collapse not possible - selection from a has_many sour...') called
at /usr/share/perl5/DBIx/Class/ResultSet.pm line 3894
DBIx::Class::ResultSet::throw_exception('DBIx::Class::ResultSet=HASH(0x2d65f08)',
'Result collapse not possible - selection from a has_many sour...') called
at /usr/share/perl5/DBIx/Class/ResultSet.pm line 1378
DBIx::Class::ResultSet::_construct_results('DBIx::Class::ResultSet=HASH(0x2d65f08)')
called at /usr/share/perl5/DBIx/Class/ResultSet.pm line 1259
DBIx::Class::ResultSet::next('DBIx::Class::ResultSet=HASH(0x2d65f08)')
called at lib/Report.pl line 27