From cc8fdd67b5712c4a544446631ce8493088b36535 Mon Sep 17 00:00:00 2001 From: Rebecca Le Date: Wed, 4 Mar 2026 13:24:14 +0800 Subject: [PATCH] fix: Fix CaseClauseError when filtering/sorting on doubly-nested embedded resource fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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', ...)`. --- lib/expr.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/expr.ex b/lib/expr.ex index 6d3fc53..3cbf422 100644 --- a/lib/expr.ex +++ b/lib/expr.ex @@ -3064,7 +3064,7 @@ defmodule AshSql.Expr do :bracket -> case first_acc do - {:bracket, path, nil, nil} -> + {:bracket, path, _, _} -> split_at_paths(type, constraints, rest, [ {bracket_or_dot, [next | path], type, constraints} | rest_acc