sub _non_unique_find_fallback {
my ($self, $cond, $attrs) = @_;
+ carp sprintf(
+ 'Search arguments do not satisfy any of the unique constraints of %s, '
+ . 'falling back to a plain search on columns: %s',
+ $self->result_source->source_name,
+ join (', ', map { "'$_'" } sort keys %$cond ),
+ );
+
return $self->_qualify_cond_columns(
$cond,
exists $attrs->{alias}
'CD year column updated correctly',
);
-# expect a failing create:
+# expect a failing create (with a warning):
# the unique constraint is not complete, and there is nothing
# in the database with such a year yet - insertion will fail due
# to missing artist fk
-throws_ok {
- $genre->update_or_create_related ('cds', {
- year => 2020,
- title => 'the best thing since sliced bread',
- })
-} qr/\Qcd.artist may not be NULL/, 'ambiguous find + create failed';
+warnings_exist {
+ throws_ok {
+ $genre->update_or_create_related ('cds', {
+ year => 2020,
+ title => 'the best thing since sliced bread',
+ })
+ } qr/\Qcd.artist may not be NULL/, 'ambiguous find + create failed'
+} qr/Search arguments do not satisfy any of the unique constraints/, 'warned on ambiguous condition';
# expect a create, after a failed search using *only* the
# *current* relationship and the unique column constraints