[rubygem-activerecord/f18] RHBZ#969448 - NULLS FIRST/LAST SQL statement fix for PostgreSQL

Vít Ondruch vondruch at fedoraproject.org
Fri May 31 13:59:46 UTC 2013


commit db3fdde80eaba01c70c23af718e78b6bd3f95f64
Author: Lukas Zapletal <lzap+git at redhat.com>
Date:   Fri May 31 14:45:55 2013 +0200

    RHBZ#969448 - NULLS FIRST/LAST SQL statement fix for PostgreSQL

 ...erecord-3.2.9-rhbz963295-nulls-first-last.patch |   26 ++++++++++++++++++++
 rubygem-activerecord.spec                          |   10 +++++++-
 2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/rubygem-activerecord-3.2.9-rhbz963295-nulls-first-last.patch b/rubygem-activerecord-3.2.9-rhbz963295-nulls-first-last.patch
new file mode 100644
index 0000000..f13ed49
--- /dev/null
+++ b/rubygem-activerecord-3.2.9-rhbz963295-nulls-first-last.patch
@@ -0,0 +1,26 @@
+From 404b73bce1f9347ca05b1496db8fc64438d66bd2 Mon Sep 17 00:00:00 2001
+From: kennyj <kennyj at gmail.com>
+Date: Sat, 25 Feb 2012 23:01:43 +0900
+Subject: [PATCH] Remove NULLS FIRST/LAST. closes #5152
+
+---
+ .../lib/active_record/connection_adapters/postgresql_adapter.rb      | 2 +-
+ .../test/cases/adapters/postgresql/postgresql_adapter_test.rb        | 5 +++++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+index c675b64..d2126a3 100644
+--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
++++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+@@ -1189,7 +1189,7 @@ def distinct(columns, orders) #:nodoc:
+ 
+         # Construct a clean list of column names from the ORDER BY clause, removing
+         # any ASC/DESC modifiers
+-        order_columns = orders.collect { |s| s.gsub(/\s+(ASC|DESC)\s*/i, '') }
++        order_columns = orders.collect { |s| s.gsub(/\s+(ASC|DESC)\s*(NULLS\s+(FIRST|LAST)\s*)?/i, '') }
+         order_columns.delete_if { |c| c.blank? }
+         order_columns = order_columns.zip((0...order_columns.size).to_a).map { |s,i| "#{s} AS alias_#{i}" }
+ 
+-- 
+1.8.1.6
+
diff --git a/rubygem-activerecord.spec b/rubygem-activerecord.spec
index 19146c3..162c9ad 100644
--- a/rubygem-activerecord.spec
+++ b/rubygem-activerecord.spec
@@ -6,7 +6,7 @@ Summary: Implements the ActiveRecord pattern for ORM
 Name: rubygem-%{gem_name}
 Epoch: 1
 Version: 3.2.8
-Release: 5%{?dist}
+Release: 6%{?dist}
 Group: Development/Languages
 License: MIT
 URL: http://www.rubyonrails.org
@@ -30,6 +30,10 @@ Patch1: rubygem-activerecord-3.2.11-CVE-2013-0155-null_array_param.patch
 Patch2: rubygem-activerecord-3.2.13-CVE-2013-1854-attribute_symbols.patch
 Patch3: rubygem-activerecord-3.2.13-CVE-2013-1854-attribute_symbols-test.patch
 
+# Bug in 3.2.8 activerecords prevents to do some SQL squeries with PostgreSQL
+# https://bugzilla.redhat.com/show_bug.cgi?id=969448
+Patch4: rubygem-activerecord-3.2.9-rhbz963295-nulls-first-last.patch
+
 Requires: ruby(abi) = %{rubyabi}
 Requires: ruby(rubygems)
 Requires: rubygem(activesupport) = %{version}
@@ -74,6 +78,7 @@ pushd .%{gem_instdir}
 %patch0 -p2
 %patch1 -p2
 %patch2 -p2
+%patch4 -p2
 popd
 
 %build
@@ -122,6 +127,9 @@ popd
 
 
 %changelog
+* Fri May 31 2013 Lukas Zapletal <lzap+rpm at redhat.com> - 1:3.2.8-6
+- RHBZ#969448 - NULLS FIRST/LAST SQL statement fix for PostgreSQL
+
 * Thu Mar 21 2013 Vít Ondruch <vondruch at redhat.com> - 1:3.2.8-5
 - Fix for CVE-2013-1854.
 


More information about the scm-commits mailing list