Frew Schmidt via RT wrote:
Show quoted text> This is actually a bug in DBIx::Class and/or SQLite. Basically if you
> have a resultset and call count on it, if there were no rows, SQLite
> returns NULL/undef (which I think is standard)
Nonsense. A COUNT() function always returns an integer, not only in
SQLite but any RDBMS I've ever seen (a lot of stuff would break if this
was not the case).
The problem is that ::AutoRemoveColumns is broken (and evidently
undertested). It does not allow one to specify an explicit selection
list (which is what the DBIC core code correctly does here [1]) - it
will always add the default list on its own (since it does not do a
proper secondary ->search() chain).
The result is:
perl -Ilib -It/lib -MTestSchema -e 'my $s = TestSchema->deploy_or_connect; $s->storage->debug(1); $s->resultset("Bloaty")->count'
SELECT "me"."id", COUNT( * ) FROM "Bloaty" "me":
Use of uninitialized value $count in numeric lt (<) at /home/rabbit/perl5/perlbrew/perls/5.16.2/lib/site_perl/5.16.2/DBIx/Class/ResultSet.pm line 1619.
Not a DBIC bug, will close 92028 when PAUSE is back.
[1]
https://github.com/dbsrgits/dbix-class/blob/master/lib/DBIx/Class/ResultSet.pm#L1673