Skip to content

Conversation

@alexander-beedie
Copy link
Contributor

@alexander-beedie alexander-beedie commented Jan 8, 2026

There's a bug in Pipe SQL parsing with identifiers followed by the |> operator.

Fix

parse_identifiers needs to break on Token::VerticalBarRightAngleBracket as well, otherwise it continues to consume the following tokens as Ident (until one of the other break conditions is encountered).

Example

FROM t |> DROP c |> RENAME a AS x

Without the fix the DROP section consumes the RENAME tokens as identifiers:

Drop { columns: [
    Ident { value: "c" },
    Ident { value: "RENAME" },
    Ident { value: "a" },
    Ident { value: "AS" },
    Ident { value: "x" }]
}

After the fix the identifier boundary is respected, and the operations parse correctly:

Drop { columns: [Ident { value: "c" }] }
Rename { mappings: [
    IdentWithAlias { ident: Ident { value: "a" }, alias: Ident { value: "x" } }]
}

Also

  • Updated the pipe operator tests with some new coverage for the above, and implemented a test_pipe! helper macro that additionally validates pipe queries starting "FROM <tbl>" (in addition to "SELECT * FROM <tbl>").

  • Split the test into several more manageable tests for clarity (one per pipe-operator).

@alexander-beedie alexander-beedie changed the title Fix identifier parsing not breaking on the pipe operator Fix identifier parsing not breaking on the |> pipe operator Jan 8, 2026
@alexander-beedie
Copy link
Contributor Author

Rebased / addressed test format👌

Comment on lines +16231 to +16233
for dialect in pipe_dialects() {
test_pipe!(dialect, input = "AS new_users", canonical = "AS new_users");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we drop the test_pipe macro entirely and write the test cases explicitly like dialects.verified_stmt("SELECT * FROM users |> WHERE id = 1");. And likely we should drop the pipe_dialects() method and construct the dialects explicitly too. For similar reason mentioned previously in that its not obvious without reading a bit of custom code to figure out what the tests are doing and I don't think its worth it in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants