[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/04: Sort derivation output details ids
From: |
Christopher Baines |
Subject: |
03/04: Sort derivation output details ids |
Date: |
Fri, 8 Jul 2022 11:03:50 -0400 (EDT) |
cbaines pushed a commit to branch master
in repository data-service.
commit 6da5e8e67b4a5241243abbae812c4b9ba2bbb5cd
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Fri Jul 8 12:36:20 2022 +0100
Sort derivation output details ids
To ensure that direct array comparison can be used in the query.
---
guix-data-service/model/derivation.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/guix-data-service/model/derivation.scm
b/guix-data-service/model/derivation.scm
index 696e2fd..5465054 100644
--- a/guix-data-service/model/derivation.scm
+++ b/guix-data-service/model/derivation.scm
@@ -989,6 +989,9 @@ LOCK TABLE ONLY derivation_output_details
(define (derivation-output-details-ids->derivation-output-details-set-id
conn
derivation-output-details-ids)
+ (define sorted-derivation-output-details-ids
+ (sort derivation-output-details-ids <))
+
(define (select-derivation-output-details-sets-id)
(match (exec-query
conn
@@ -998,7 +1001,7 @@ SELECT id
FROM derivation_output_details_sets
WHERE derivation_output_details_ids = ARRAY["
(string-join (map number->string
- derivation-output-details-ids)
+ sorted-derivation-output-details-ids)
",")
"]"))
(((id))
@@ -1012,7 +1015,8 @@ WHERE derivation_output_details_ids = ARRAY["
"
INSERT INTO derivation_output_details_sets (derivation_output_details_ids)
VALUES (ARRAY["
- (string-join (map number->string derivation-output-details-ids)
+ (string-join (map number->string
+ sorted-derivation-output-details-ids)
",")
"])
RETURNING id"))