Skip to content

CTE Syntax Error #24889

@mcgrawia

Description

@mcgrawia

Hi, I am trying to run a query using a subquery CTE and am getting a syntax error. Is this supposed to work?

with cte as (select * from numbers(10))
select * from cte;

Error:

Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 41 ('FORMAT') (line 2, col 1): FORMAT TabSeparatedWithNamesAndTypes;. Expected one of: SELECT, Comma, token (version 21.1.2.15 (official build))

I notice when I move it on to one line, it works as expected:

with cte as (select * from numbers(10)) select * from cte;

Result:

0
1
2
3
4
5
6
7
8
9

I am using version 21.1.2.15.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion?st-need-infoWe need extra data to continue (waiting for response). Either some details or a repro of the issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions