-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f18b6b
commit 6f19c0c
Showing
3 changed files
with
43 additions
and
32 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
.sqlx/query-7a46794bf17b8ae29e3a4774946639d1b29b7d7b3c4cc0792e1ce67456cd8b36.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
.sqlx/query-8289e1461bf6053c3f2096b595d5ad34c8be567788d9288fe786f67b3be7c8f1.json
This file was deleted.
Oops, something went wrong.
15 changes: 13 additions & 2 deletions
15
src/eth/storage/postgres_permanent/sql/select_historical_slots.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
SELECT idx as "index: _", value as "value: _" | ||
WITH max_block_number AS ( | ||
SELECT idx, | ||
MAX(block_number) as num | ||
FROM historical_slots | ||
WHERE block_number <= $3 | ||
AND account_address = $2 | ||
AND idx = ANY($1) | ||
GROUP BY idx | ||
) | ||
SELECT historical_slots.idx as "index: _", | ||
value as "value: _" | ||
FROM historical_slots | ||
WHERE idx = ANY($1) AND account_address = $2 AND block_number = $3 | ||
JOIN max_block_number ON max_block_number.idx = historical_slots.idx | ||
AND max_block_number.num = historical_slots.block_number |