From 74f493d02836bf4efc01197b0864692477091012 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 11 Dec 2017 20:49:36 +0000 Subject: Handle the case where IUSE contains the same flag with different default flags --- gentoobrowse-api/service/sql/maintenance/ebuildUsesInsert.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gentoobrowse-api/service/sql/maintenance/ebuildUsesInsert.sql b/gentoobrowse-api/service/sql/maintenance/ebuildUsesInsert.sql index b6f822e..2def689 100644 --- a/gentoobrowse-api/service/sql/maintenance/ebuildUsesInsert.sql +++ b/gentoobrowse-api/service/sql/maintenance/ebuildUsesInsert.sql @@ -1,5 +1,9 @@ INSERT INTO tmpEbuildUses(ebuildId, use, defaultflag) -SELECT DISTINCT ?::INT, +SELECT ?::INT, LTRIM(r, '-+'), - CASE WHEN LEFT(r, 1) = '-' THEN FALSE WHEN LEFT(r, 1) = '+' THEN TRUE END + CASE + WHEN MIN(LEFT(r, 1)) = '+' THEN TRUE + WHEN MIN(LEFT(r, 1)) = '-' THEN FALSE + END FROM REGEXP_SPLIT_TO_TABLE(?, '\s+') r +GROUP BY LTRIM(r, '-+') -- cgit v1.2.3