Support querying package derivation outputs without the nars

Since this speeds up the response if you don't need the nar information.
This commit is contained in:
Christopher Baines 2022-01-31 20:24:27 +00:00
parent 11ec8a8064
commit f1418c4e88
5 changed files with 62 additions and 6 deletions

View file

@ -678,6 +678,7 @@ LIMIT $4"))
no-nars-from-build-servers
system
target
include-nars?
limit-results
after-path)
(define query
@ -688,7 +689,10 @@ SELECT packages.name,
derivation_output_details.path,
derivation_output_details.hash_algorithm,
derivation_output_details.hash,
derivation_output_details.recursive,
derivation_output_details.recursive"
(if include-nars?
",
(
SELECT JSON_AGG(
json_build_object(
@ -706,7 +710,9 @@ SELECT packages.name,
INNER JOIN narinfo_fetch_records
ON narinfo_signature_data.id = narinfo_fetch_records.narinfo_signature_data_id
WHERE nars.store_path = derivation_output_details.path
) AS nars
) AS nars"
"")
"
FROM derivations
INNER JOIN derivation_outputs
ON derivations.id = derivation_outputs.derivation_id
@ -833,7 +839,15 @@ ORDER BY derivation_output_details.path
(string=? recursive "t")
(if (null? nars_json)
#()
(json-string->scm nars_json)))))
(json-string->scm nars_json))))
((package_name package_version
path hash_algorithm hash recursive)
(list package_name
package_version
path
hash
hash_algorithm
(string=? recursive "t"))))
(exec-query-with-null-handling conn
query
`(,commit-hash