Skip to content

Commit 957ec04

Browse files
authored
fix: Fix CaseClauseError when filtering/sorting on doubly-nested embedded resource fields (#217)
`split_at_paths` accumulates path segments as it walks a `get_path` expression. The `:bracket` arm only matched `{:bracket, path, nil, nil}` — the initial empty state. After the first embedded hop the accumulator carries real type and constraint info, so no clause matched and a `CaseClauseError` was raised. Widening the pattern to `{:bracket, path, _, _}` allows consecutive JSONB bracket accesses to keep accumulating into the same segment, which `do_get_path` already handles correctly via `jsonb_extract_path_text(col, 'key1', 'key2', ...)`.
1 parent 3ced0d2 commit 957ec04

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/expr.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3064,7 +3064,7 @@ defmodule AshSql.Expr do
30643064

30653065
:bracket ->
30663066
case first_acc do
3067-
{:bracket, path, nil, nil} ->
3067+
{:bracket, path, _, _} ->
30683068
split_at_paths(type, constraints, rest, [
30693069
{bracket_or_dot, [next | path], type, constraints}
30703070
| rest_acc

0 commit comments

Comments
 (0)