Skip to content

Commit

Permalink
Hotfix: Make OrderWithQuote as inner join in order not to get nullabl…
Browse files Browse the repository at this point in the history
…e quotes (#2477)

# Description
Do an `inner join` instead of `left join` in order not to have nullable
quotes in case they do not exist.

This query will be removed with
#2469

# Changes
Do an `inner join` instead of `left join` in order not to have nullable
quotes in case they do not exist. This way it does not error in case of
missing quote (it won't be counted, as it is a liquidity order anyway).

## How to test
1. CI
2. e2e
  • Loading branch information
m-lord-renkse authored Mar 5, 2024
1 parent 3cda785 commit e7fe5bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/database/src/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,14 +739,14 @@ pub async fn user_orders_with_quote(
" o_quotes.buy_amount as quote_buy_amount, o.buy_amount as order_buy_amount,",
" o.fee_amount as order_fee_amount, o_quotes.gas_amount as quote_gas_amount,",
" o_quotes.gas_price as quote_gas_price, o_quotes.sell_token_price as quote_sell_token_price",
" FROM order_quotes o_quotes",
" LEFT JOIN (",
" FROM (",
" SELECT *",
" FROM (", OPEN_ORDERS,
" AND owner = $2",
" AND class = 'limit'",
" ) AS subquery",
" ) AS o ON o_quotes.order_uid = o.uid"
" ) AS o",
" INNER JOIN order_quotes o_quotes ON o.uid = o_quotes.order_uid"
);
sqlx::query_as::<_, OrderWithQuote>(QUERY)
.bind(min_valid_to)
Expand Down

0 comments on commit e7fe5bc

Please sign in to comment.