From: Peter Rabbitson Date: Mon, 8 Sep 2014 09:14:29 +0000 (+0200) Subject: Fix for gut-reaching travesty as reported by gbjk X-Git-Tag: v0.082800~55 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2a7875330aa2f812eaa325ce69f0fa1c860771ac;p=dbsrgits%2FDBIx-Class.git Fix for gut-reaching travesty as reported by gbjk --- diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 6baff16..4550af8 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -1580,7 +1580,7 @@ sub _minimal_valueset_satisfying_constraint { $cols->{fc}{$col} = 1 if ( ! ( $cols->{missing} || {})->{$col} and - $args->{columns_info}{$col}{_filter_info} + keys %{ $args->{columns_info}{$col}{_filter_info} || {} } ); } diff --git a/t/row/filter_column.t b/t/row/filter_column.t index 10ac1a4..7823fa5 100644 --- a/t/row/filter_column.t +++ b/t/row/filter_column.t @@ -260,6 +260,18 @@ throws_ok { DBICTest::Schema::Artist->filter_column( charfield => {} ) } ; FC_ON_PK_TEST: { + # there are cases in the wild that autovivify stuff deep in the + # colinfo guts. While this is insane, there is no alternative + # so at leats make sure it keeps working... + + $schema->source('Artist')->column_info('artistid')->{_filter_info} ||= {}; + + for my $key ('', 'primary') { + lives_ok { + $schema->resultset('Artist')->find_or_create({ artistid => 42 }, { $key ? ( key => $key ) : () }); + }; + } + DBICTest::Schema::Artist->filter_column(artistid => { filter_to_storage => sub { $_[1] * 100 },