Skip to content

Commit

Permalink
complain about undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 28, 2018
1 parent d548d0a commit b8291b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/SQL/Abstract/Pg.pm
Expand Up @@ -123,6 +123,7 @@ sub _table {
$table = $self->SUPER::_table(\@table);
for my $join (@join) {
puke 'join value needs at least 3 elements' if @$join < 3;
puke 'join values cannot be undefined' if grep { !defined $_ } @$join;
my $type = @$join > 3 ? shift @$join : '';
my ($name, $fk, $pk) = @$join;
$table
Expand Down
2 changes: 2 additions & 0 deletions t/sql.t
Expand Up @@ -122,5 +122,7 @@ is_deeply \@sql,
# JOIN (unsupported value)
eval { $abstract->select(['foo', []]) };
like $@, qr/join value needs at least 3 elements/, 'right error';
eval { $abstract->select(['foo', [undef, undef, undef]]) };
like $@, qr/join values cannot be undefined/, 'right error';

done_testing();

0 comments on commit b8291b3

Please sign in to comment.