summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-12-11 20:49:36 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-12-11 20:49:36 +0000
commit74f493d02836bf4efc01197b0864692477091012 (patch)
tree8bb6af741e4fa8b0dcdb841a3629f44057200b49
parentMove the +/- flag in IUSE entries into its own field (diff)
downloadgentoobrowse-api-74f493d02836bf4efc01197b0864692477091012.tar.bz2
gentoobrowse-api-74f493d02836bf4efc01197b0864692477091012.tar.xz
gentoobrowse-api-74f493d02836bf4efc01197b0864692477091012.zip
Handle the case where IUSE contains the same flag with different default flagsgentoobrowse-api-0.9.3
-rw-r--r--gentoobrowse-api/service/sql/maintenance/ebuildUsesInsert.sql8
1 files 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, '-+')