From 55a3ec559d03e9f6c5dc0013c4030563e2dcad3d Mon Sep 17 00:00:00 2001 From: Cola Cheng Date: Fri, 11 Sep 2026 16:15:35 +0800 Subject: [PATCH 1/2] Document filter/2 support on SQLite 3.30+. The previous note said FILTER was Postgres-only; SQLite has supported it since 3.30. --- lib/ecto/query/api.ex | 2 +- lib/ecto/query/window_api.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ecto/query/api.ex b/lib/ecto/query/api.ex index f161889a84..7f2aec213c 100644 --- a/lib/ecto/query/api.ex +++ b/lib/ecto/query/api.ex @@ -278,7 +278,7 @@ defmodule Ecto.Query.API do @doc """ Applies the given expression as a FILTER clause against an - aggregate. This is currently only supported by Postgres. + aggregate. This is supported by Postgres and SQLite 3.30+. from p in Payment, select: filter(avg(p.value), p.value > 0 and p.value < 100) diff --git a/lib/ecto/query/window_api.ex b/lib/ecto/query/window_api.ex index 6e6a900d23..3a645a91e4 100644 --- a/lib/ecto/query/window_api.ex +++ b/lib/ecto/query/window_api.ex @@ -160,7 +160,7 @@ defmodule Ecto.Query.WindowAPI do @doc """ Applies the given expression as a FILTER clause against an - aggregate. This is currently only supported by Postgres. + aggregate. This is supported by Postgres and SQLite 3.30+. from p in Post, select: avg(p.value) From f177dbd43a451b5fd83be01e8c6880afde48460c Mon Sep 17 00:00:00 2001 From: Cola Cheng Date: Fri, 11 Sep 2026 22:05:49 +0800 Subject: [PATCH 2/2] Avoid listing databases in filter/2 docs. Name-specific support notes go stale; point readers at their database docs instead. --- lib/ecto/query/api.ex | 3 ++- lib/ecto/query/window_api.ex | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ecto/query/api.ex b/lib/ecto/query/api.ex index 7f2aec213c..299144ee0a 100644 --- a/lib/ecto/query/api.ex +++ b/lib/ecto/query/api.ex @@ -278,7 +278,8 @@ defmodule Ecto.Query.API do @doc """ Applies the given expression as a FILTER clause against an - aggregate. This is supported by Postgres and SQLite 3.30+. + aggregate. Not all databases support this operation. Please + check your database documentation. from p in Payment, select: filter(avg(p.value), p.value > 0 and p.value < 100) diff --git a/lib/ecto/query/window_api.ex b/lib/ecto/query/window_api.ex index 3a645a91e4..d4fe813e42 100644 --- a/lib/ecto/query/window_api.ex +++ b/lib/ecto/query/window_api.ex @@ -160,7 +160,8 @@ defmodule Ecto.Query.WindowAPI do @doc """ Applies the given expression as a FILTER clause against an - aggregate. This is supported by Postgres and SQLite 3.30+. + aggregate. Not all databases support this operation. Please + check your database documentation. from p in Post, select: avg(p.value)