Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7124230
D6991.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D6991.diff
View Options
diff --git a/swh/provenance/postgresql/archive.py b/swh/provenance/postgresql/archive.py
--- a/swh/provenance/postgresql/archive.py
+++ b/swh/provenance/postgresql/archive.py
@@ -33,10 +33,10 @@
cursor.execute(
"""
WITH
- dir AS (SELECT id AS dir_id, dir_entries, file_entries
+ dir AS (SELECT dir_entries, file_entries
FROM directory WHERE id=%s),
- ls_d AS (SELECT dir_id, UNNEST(dir_entries) AS entry_id FROM dir),
- ls_f AS (SELECT dir_id, UNNEST(file_entries) AS entry_id FROM dir)
+ ls_d AS (SELECT DISTINCT UNNEST(dir_entries) AS entry_id FROM dir),
+ ls_f AS (SELECT DISTINCT UNNEST(file_entries) AS entry_id FROM dir)
(SELECT 'dir'::directory_entry_type AS type, e.target, e.name
FROM ls_d
LEFT JOIN directory_entry_dir e ON ls_d.entry_id=e.id)
@@ -68,10 +68,10 @@
cursor.execute(
"""
WITH
- dir AS (SELECT id AS dir_id, dir_entries, file_entries
+ dir AS (SELECT dir_entries, file_entries
FROM directory WHERE id=%s),
- ls_d AS (SELECT dir_id, UNNEST(dir_entries) AS entry_id FROM dir),
- ls_f AS (SELECT dir_id, UNNEST(file_entries) AS entry_id FROM dir)
+ ls_d AS (SELECT DISTINCT UNNEST(dir_entries) AS entry_id FROM dir),
+ ls_f AS (SELECT DISTINCT UNNEST(file_entries) AS entry_id FROM dir)
(SELECT 'dir'::directory_entry_type AS type, e.target, e.name
FROM ls_d
LEFT JOIN directory_entry_dir e ON ls_d.entry_id=e.id)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 21 2024, 2:11 AM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3215566
Attached To
D6991: Fix direct sql query for directories to the archive
Event Timeline
Log In to Comment