From c30b327a1b4ee54681e845506cdafe71b9d1a86b Mon Sep 17 00:00:00 2001 From: renancloudwalk <53792026+renancloudwalk@users.noreply.github.com> Date: Thu, 14 Mar 2024 13:36:09 -0300 Subject: [PATCH] fix: alias on query (#348) --- ...9b3504517a4f5ee22ac79f37c3d8e5fd5ae22e9d2d43355b476c.json} | 4 ++-- .../storage/postgres/queries/select_random_slot_sample.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename .sqlx/{query-13a8805112acd60f7a2cda1f468f9cb51ea244b95a376ef962c5c2932e9b15a4.json => query-f9a99a26648d9b3504517a4f5ee22ac79f37c3d8e5fd5ae22e9d2d43355b476c.json} (87%) diff --git a/.sqlx/query-13a8805112acd60f7a2cda1f468f9cb51ea244b95a376ef962c5c2932e9b15a4.json b/.sqlx/query-f9a99a26648d9b3504517a4f5ee22ac79f37c3d8e5fd5ae22e9d2d43355b476c.json similarity index 87% rename from .sqlx/query-13a8805112acd60f7a2cda1f468f9cb51ea244b95a376ef962c5c2932e9b15a4.json rename to .sqlx/query-f9a99a26648d9b3504517a4f5ee22ac79f37c3d8e5fd5ae22e9d2d43355b476c.json index 7fca36022..ccd0b75c1 100644 --- a/.sqlx/query-13a8805112acd60f7a2cda1f468f9cb51ea244b95a376ef962c5c2932e9b15a4.json +++ b/.sqlx/query-f9a99a26648d9b3504517a4f5ee22ac79f37c3d8e5fd5ae22e9d2d43355b476c.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT\n idx as \"index!: _\",\n value as \"value!: _\",\n account_address as \"address!: _\",\n block_number as \"block_number!: _\"\nFROM\n (SELECT\n setseed($1),\n null as \"idx\",\n null as \"value\",\n null as \"account_address\",\n null as \"block_number\"\n UNION ALL\n SELECT\n null,\n idx,\n value,\n account_address,\n block_number\n FROM historical_slots\n WHERE block_number >= $2 AND block_number < $3\n OFFSET 1\n )\nORDER BY random()\nLIMIT $4;\n", + "query": "SELECT\n idx as \"index!: _\",\n value as \"value!: _\",\n account_address as \"address!: _\",\n block_number as \"block_number!: _\"\nFROM\n (SELECT\n setseed($1),\n null as \"idx\",\n null as \"value\",\n null as \"account_address\",\n null as \"block_number\"\n UNION ALL\n SELECT\n null,\n idx,\n value,\n account_address,\n block_number\n FROM historical_slots\n WHERE block_number >= $2 AND block_number < $3\n OFFSET 1\n ) as random_slot_sample\nORDER BY random()\nLIMIT $4;\n", "describe": { "columns": [ { @@ -39,5 +39,5 @@ null ] }, - "hash": "13a8805112acd60f7a2cda1f468f9cb51ea244b95a376ef962c5c2932e9b15a4" + "hash": "f9a99a26648d9b3504517a4f5ee22ac79f37c3d8e5fd5ae22e9d2d43355b476c" } diff --git a/src/eth/storage/postgres/queries/select_random_slot_sample.sql b/src/eth/storage/postgres/queries/select_random_slot_sample.sql index 7fc33cf43..de2e8e6d0 100644 --- a/src/eth/storage/postgres/queries/select_random_slot_sample.sql +++ b/src/eth/storage/postgres/queries/select_random_slot_sample.sql @@ -20,6 +20,6 @@ FROM FROM historical_slots WHERE block_number >= $2 AND block_number < $3 OFFSET 1 - ) + ) as random_slot_sample ORDER BY random() LIMIT $4;