plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 2);
my $schema = DBICTest->init_schema();
+$schema->storage->debug(1);
my $no_prefetch = $schema->resultset('Artist')->search(
undef,
{ rows => 3 }
is($no_prefetch->count, $use_prefetch->count, '$no_prefetch->count == $use_prefetch->count');
+# The fix is to, when using prefetch, take the query and put it into a subquery
+# joined to the tables we're prefetching from. This might result in the same
+# table being joined once in the main subquery and once in the main query. This
+# may actually resolve other, unknown edgecase bugs. It is also the right way
+# to do prefetching. Optimizations can come later.
+
TODO: {
local $TODO = "This is a difficult bug to fix, workaround is not to use prefetch with rows";
$no_prefetch_count++ while $no_prefetch->next;