summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-08-03 12:16:55 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-08-03 12:16:55 +0200
commit767039b4ae3a933b8d593d88336a7a9432235178 (patch)
tree852fe330240d92d778d4ff20f0bced61ce26b63e
parentf4f66107dadb82a81bd48c6584c14dad9e80b39a (diff)
downloadbugzilla-767039b4ae3a933b8d593d88336a7a9432235178.tar.gz
bugzilla-767039b4ae3a933b8d593d88336a7a9432235178.tar.xz
Bug 780028: Oracle crashes if a column listed in ORDER BY appears twice in SELECT
r=glob a=LpSolit
-rw-r--r--Bugzilla/Search.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index e9baa124b..21a952e9c 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -835,10 +835,19 @@ sub _add_extra_column {
# These are the columns that we're going to be actually SELECTing.
sub _display_columns {
my ($self) = @_;
- # Do not alter the list specified here at all, even if they are duplicated.
- # Those are passed by the caller, and the caller expects to get them back
- # in the exact same order.
- $self->{display_columns} ||= [$self->_input_columns, $self->_extra_columns];
+ return @{ $self->{display_columns} } if $self->{display_columns};
+
+ # Do not alter the list from _input_columns at all, even if there are
+ # duplicated columns. Those are passed by the caller, and the caller
+ # expects to get them back in the exact same order.
+ my @columns = $self->_input_columns;
+
+ # Only add columns which are not already listed.
+ my %list = map { $_ => 1 } @columns;
+ foreach my $column ($self->_extra_columns) {
+ push(@columns, $column) unless $list{$column}++;
+ }
+ $self->{display_columns} = \@columns;
return @{ $self->{display_columns} };
}