Skip to content

Commit 27beaa4

Browse files
committed
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
1 parent 3119462 commit 27beaa4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/mix/tasks/sql.gen.parser.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ defmodule Mix.Tasks.Sql.Gen.Parser do
156156
def insert_node({:with = tag, meta, []}, [{:ident, _, _} = l, {:parens, _, _} = r, {:as = t2, m2, a}], [], context, root) do
157157
{[], [], context, root ++ [{tag, meta, [{t2, m2, [[l, r] | a]}]}]}
158158
end
159-
def insert_node({:with = tag, meta, []}, unit, acc, context, root) do
159+
def insert_node({:with = tag, meta, []}, [{:ident, _, _}, {:as, _, _}] = unit, acc, context, root) do
160160
{[], [], context, root ++ [{tag, meta, unit ++ acc}]}
161161
end
162162
def insert_node({tag, meta, []}, unit, acc, context, root) when tag in ~w[by in references]a do

lib/parser.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ defmodule SQL.Parser do
126126
def insert_node({:with = tag, meta, []}, [{:ident, _, _} = l, {:parens, _, _} = r, {:as = t2, m2, a}], [], context, root) do
127127
{[], [], context, root ++ [{tag, meta, [{t2, m2, [[l, r] | a]}]}]}
128128
end
129-
def insert_node({:with = tag, meta, []}, unit, acc, context, root) do
129+
def insert_node({:with = tag, meta, []}, [{:ident, _, _}, {:as, _, _}] = unit, acc, context, root) do
130130
{[], [], context, root ++ [{tag, meta, unit ++ acc}]}
131131
end
132132
def insert_node({tag, meta, []}, unit, acc, context, root) when tag in ~w[by in references]a do

0 commit comments

Comments
 (0)