diff options
author | Johannes Krampf <johannes.krampf@gmail.com> | 2011-12-03 14:18:07 +0100 |
---|---|---|
committer | Johannes Krampf <johannes.krampf@gmail.com> | 2011-12-03 14:18:07 +0100 |
commit | f71f3e23eda8e1ff447340812025ab724aff14cb (patch) | |
tree | f736f2c42a8f01649bfbd80deaa5b2f904c89fe6 /packages | |
parent | e81d8848650b88af2ed08c4e4fa9e6d98757aebc (diff) |
Fix differences query if there are more than 2 architectures
Diffstat (limited to 'packages')
-rw-r--r-- | packages/utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/utils.py b/packages/utils.py index f8e1f2a1..82d47bc7 100644 --- a/packages/utils.py +++ b/packages/utils.py @@ -106,7 +106,11 @@ SELECT p.id, q.id AND p.arch_id != q.arch_id AND p.id != q.id ) - WHERE p.arch_id IN (%s, %s) + WHERE p.arch_id in (%s, %s) + AND ( + q.arch_id in (%s, %s) + OR q.id IS NULL + ) AND ( q.id IS NULL OR p.pkgver != q.pkgver @@ -115,7 +119,7 @@ SELECT p.id, q.id ) """ cursor = connection.cursor() - cursor.execute(sql, [arch_a.id, arch_b.id]) + cursor.execute(sql, [arch_a.id, arch_b.id, arch_a.id, arch_b.id]) results = cursor.fetchall() # column A will always have a value, column B might be NULL to_fetch = [row[0] for row in results] |