From 4993f11bf464c9aee0e3fd5965f4a8258cbe8b30 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Sat, 31 Oct 2015 21:38:19 +0200
Subject: Bug fix in latest_packages() PostgreSQL function

---
 brep/package-extra.sql | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'brep/package-extra.sql')

diff --git a/brep/package-extra.sql b/brep/package-extra.sql
index d30a48e..6859173 100644
--- a/brep/package-extra.sql
+++ b/brep/package-extra.sql
@@ -14,7 +14,8 @@ latest_packages()
 RETURNS SETOF package AS $$
   SELECT p1.*
   FROM package p1 LEFT JOIN package p2 ON (
-    p1.name = p2.name AND
+    p1.internal_repository IS NOT NULL AND p1.name = p2.name AND
+    p2.internal_repository IS NOT NULL AND
     (p1.version_epoch < p2.version_epoch OR
      p1.version_epoch = p2.version_epoch AND
      (p1.version_canonical_upstream < p2.version_canonical_upstream OR
-- 
cgit v1.1

