File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,23 +206,55 @@ defmodule AshSql.Expr do
206206 _type
207207 )
208208 when mod in [ IsDistinctFrom , IsNotDistinctFrom ] do
209- { left_expr , acc } =
210- do_dynamic_expr (
211- query ,
212- left ,
213- set_location ( bindings , :sub_expr ) ,
214- pred_embedded? || embedded? ,
215- acc
209+ { [ left_type , right_type ] , _type } =
210+ determine_types (
211+ bindings . sql_behaviour ,
212+ mod ,
213+ [ left , right ] ,
214+ :boolean
216215 )
217216
217+ { left_expr , acc } =
218+ if left_type do
219+ maybe_type_expr (
220+ query ,
221+ left ,
222+ set_location ( bindings , :sub_expr ) ,
223+ pred_embedded? || embedded? ,
224+ acc ,
225+ left_type
226+ )
227+ else
228+ do_dynamic_expr (
229+ query ,
230+ left ,
231+ set_location ( bindings , :sub_expr ) ,
232+ pred_embedded? || embedded? ,
233+ acc ,
234+ nil
235+ )
236+ end
237+
218238 { right_expr , acc } =
219- do_dynamic_expr (
220- query ,
221- right ,
222- set_location ( bindings , :sub_expr ) ,
223- pred_embedded? || embedded? ,
224- acc
225- )
239+ if right_type do
240+ maybe_type_expr (
241+ query ,
242+ right ,
243+ set_location ( bindings , :sub_expr ) ,
244+ pred_embedded? || embedded? ,
245+ acc ,
246+ right_type
247+ )
248+ else
249+ do_dynamic_expr (
250+ query ,
251+ right ,
252+ set_location ( bindings , :sub_expr ) ,
253+ pred_embedded? || embedded? ,
254+ acc ,
255+ nil
256+ )
257+ end
226258
227259 dynamic =
228260 case mod do
You can’t perform that action at this time.
0 commit comments