From 27beaa4fd628c7a34a273c21cb46f1af16a54e86 Mon Sep 17 00:00:00 2001 From: KaFai Choi Date: Mon, 2 Jun 2025 09:13:51 +0700 Subject: [PATCH 1/2] fix regression bug introduced in fixing CTE bug previously The bug was because the new with catch is too aggressive and accidentally include other non-CTE with --- lib/mix/tasks/sql.gen.parser.ex | 2 +- lib/parser.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mix/tasks/sql.gen.parser.ex b/lib/mix/tasks/sql.gen.parser.ex index d845d4e..68453fd 100644 --- a/lib/mix/tasks/sql.gen.parser.ex +++ b/lib/mix/tasks/sql.gen.parser.ex @@ -156,7 +156,7 @@ defmodule Mix.Tasks.Sql.Gen.Parser do def insert_node({:with = tag, meta, []}, [{:ident, _, _} = l, {:parens, _, _} = r, {:as = t2, m2, a}], [], context, root) do {[], [], context, root ++ [{tag, meta, [{t2, m2, [[l, r] | a]}]}]} end - def insert_node({:with = tag, meta, []}, unit, acc, context, root) do + def insert_node({:with = tag, meta, []}, [{:ident, _, _}, {:as, _, _}] = unit, acc, context, root) do {[], [], context, root ++ [{tag, meta, unit ++ acc}]} end def insert_node({tag, meta, []}, unit, acc, context, root) when tag in ~w[by in references]a do diff --git a/lib/parser.ex b/lib/parser.ex index 9b854a3..cbc277b 100644 --- a/lib/parser.ex +++ b/lib/parser.ex @@ -126,7 +126,7 @@ defmodule SQL.Parser do def insert_node({:with = tag, meta, []}, [{:ident, _, _} = l, {:parens, _, _} = r, {:as = t2, m2, a}], [], context, root) do {[], [], context, root ++ [{tag, meta, [{t2, m2, [[l, r] | a]}]}]} end - def insert_node({:with = tag, meta, []}, unit, acc, context, root) do + def insert_node({:with = tag, meta, []}, [{:ident, _, _}, {:as, _, _}] = unit, acc, context, root) do {[], [], context, root ++ [{tag, meta, unit ++ acc}]} end def insert_node({tag, meta, []}, unit, acc, context, root) when tag in ~w[by in references]a do From 9cc84b78da31d59e8f9b7850858b5ffaa60412e0 Mon Sep 17 00:00:00 2001 From: KaFai Choi Date: Mon, 2 Jun 2025 09:17:09 +0700 Subject: [PATCH 2/2] trigger CI in both push and pull_request --- .github/workflows/ci.yml | 4 +++- .github/workflows/conformance.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17e1e92..fe650e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,6 @@ -on: push +on: + push: + pull_request: jobs: test: runs-on: ubuntu-22.04 diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index 080ce99..237b6bf 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -1,4 +1,6 @@ -on: push +on: + push: + pull_request: jobs: test: runs-on: ubuntu-22.04