L<DBIx::Class> uses L<DBIx::Class::Relationship> names as table aliases in
queries.
-This hook is to allow specific C<Storage> drivers to change the way these
-aliases are named.
+This hook is to allow specific L<DBIx::Class::Storage> drivers to change the
+way these aliases are named.
+
+The default behavior is C<"$relname_$join_count" if $join_count > 1>, otherwise
+C<"$relname">.
=cut
sub relname_to_table_alias {
my ($self, $relname, $join_count) = @_;
- my $alias = ($join_count > 1 ? join('_', $relname, $join_count) : $relname);
+ my $alias = ($join_count && $join_count > 1 ?
+ join('_', $relname, $join_count) : $relname);
return $alias;
}