Skip to content

Commit

Permalink
[DMS-277] sql fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbanister committed Jul 22, 2024
1 parent c680e15 commit 511d158
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,13 @@ LockOption lockOption
await using NpgsqlCommand command =
new(
$@"SELECT d.ResourceName FROM dms.Document d
INNER JOIN dms.Reference r
ON r.ReferencedDocumentId = d.Id AND r.ReferencedDocumentPartitionKey = d.DocumentPartitionKey
INNER JOIN (
SELECT ParentDocumentId, ParentDocumentPartitionKey
FROM dms.Reference r
INNER JOIN dms.Document d2 ON d2.Id = r.ReferencedDocumentId
AND d2.DocumentPartitionKey = r.ReferencedDocumentPartitionKey
WHERE d2.DocumentUuid = $1 AND d2.DocumentPartitionKey = $2) AS re
ON re.ParentDocumentId = d.id AND re.ParentDocumentPartitionKey = d.DocumentPartitionKey
ORDER BY d.ResourceName {SqlFor(lockOption)};",
connection,
transaction
Expand Down

0 comments on commit 511d158

Please sign in to comment.