Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 27775
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: johanl [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08002
Fixed in: (no value)



Subject: count after a slice may return a negative row count
Take any table with a few rows (say, 15). Then do: my $rs = $schema->resultset('SomeTable')->search()->slice(1000, 1002), #0 rows A $rs->all() correctly returns an empty list, but $rs->count() returns -985. It seems the correct return value should be 0.
Here are some tests I generalized (untested) from our test suite (they may or may not be helpful): diag("With existing data, and a resultset already using slice (within the existing rows)"); ok( my $rs_format_slice_within = $schema->resultset('Format')->search()->slice(4, 6), #3 rows "Searched for all formats, using a slice that matches", ); is($rs_format_slice_within->count(), 3, " and found some using count"); diag("With existing data, and a resultset already using slice (outside the existing rows)"); ok( my $rs_format_slice_outside = $schema->resultset('Format')->search()->slice(1000, 1002), #0 rows "Searched for all formats, using a slice that's out of bounds", ); is($rs_format_slice_outside->count(), 0, " and found none using count");
fixed in trunk as of r3589, will be in 08004. thanks.