From 0ade2438400535b4b5d969244ff1b23daddaf3fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 31 Aug 2009 17:32:24 +0200 Subject: [PATCH] Und noch ein Bug: renamed columns --- SL/IC.pm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/SL/IC.pm b/SL/IC.pm index d654d008b..c9511b4db 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -847,21 +847,18 @@ sub all_parts { my $joins_needed = shift; sub { my ($col, $group) = @_; - $renamed_columns{$col} ||= $col; - my @coalesce_tokens = - map { ($_->[1] || 'p.') . $_->[0] } + map { ($_->[1] || 'p.') . $_->[0] } grep { !$_->[2] || $joins_needed->{$_->[2]} } grep { $_->[0] eq $col } - @column_override, - [ $col, $table_prefix{$col} ]; + @column_override, [ $col, $table_prefix{$col} ]; - my $coalesce = scalar @coalesce_tokens > 1; + my $coalesce = scalar @coalesce_tokens > 1; return ($coalesce ? sprintf 'COALESCE(%s)', join ', ', @coalesce_tokens : shift @coalesce_tokens) - . ($group && $coalesce - ? " AS $renamed_columns{$col}" + . ($group && ($coalesce || $renamed_columns{$col}) + ? " AS " . ($renamed_columns{$col} || $col) : ''); } }; -- 2.20.1