diff options
| author | Likai Liu <liulk@likai.org> | 2020-01-07 18:22:32 -0500 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2020-02-02 21:21:09 +0100 |
| commit | a301b79c042c5c4e8677ad6e44905903ea9375c3 (patch) | |
| tree | ca40612759532ba231b57f1388eb446dc71b67fc /sqlparse | |
| parent | 44eacf2e2f4a4255829109a5e67e0c1d2af542da (diff) | |
| download | sqlparse-a301b79c042c5c4e8677ad6e44905903ea9375c3.tar.gz | |
[grouping] group_as() no longer groups AS CTE
This patch changes the grouping of AS so that:
Foo AS WITH bar AS 1 SELECT 2
with no longer be grouped as:
[Identifier[Foo, AS, WITH, Identifier[Bar AS 1]], SELECT, 2]
but will be grouped as:
[Identifier[Foo], AS, WITH, Identifier[Bar AS 1], SELECT, 2]
This fixes the parsing of CREATE TABLE new_table AS WITH ... so the
rest of the tokens after AS are parsed the same as a bare WITH.
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/engine/grouping.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index b634128..daaffb0 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -164,7 +164,7 @@ def group_as(tlist): return token.normalized == 'NULL' or not token.is_keyword def valid_next(token): - ttypes = T.DML, T.DDL + ttypes = T.DML, T.DDL, T.CTE return not imt(token, t=ttypes) and token is not None def post(tlist, pidx, tidx, nidx): |
