Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,41 @@ var (
}, {
input: "select a from (select 1 as a from tbl1 union select 2 from tbl2) as t (a, b)",
},
{
// https://github.com/dolthub/dolt/issues/8058
Comment thread
elianddb marked this conversation as resolved.
Outdated
input: "SELECT SUM(found) FROM ((SELECT 2 as found FROM dual)) as all_found",
output: "select SUM(`found`) from (select 2 as `found`) as all_found",
},
{
// https://github.com/dolthub/dolt/issues/8058
input: "SELECT SUM(found) FROM (((SELECT 2 as found FROM dual))) as all_found",
output: "select SUM(`found`) from (select 2 as `found`) as all_found",
},
{
// https://github.com/dolthub/dolt/issues/8058
input: "SELECT EXISTS ((SELECT 1))",
output: "select exists (select 1)",
},
{
// https://github.com/dolthub/dolt/issues/8058
input: "SELECT EXISTS (((SELECT 1)))",
output: "select exists (select 1)",
},
{
// https://github.com/dolthub/dolt/issues/8058
input: "WITH t AS ((SELECT 1)) SELECT * FROM t",
output: "with t as (select 1) select * from t",
},
{
// https://github.com/dolthub/dolt/issues/8058
input: "WITH t AS (((SELECT 1))) SELECT * FROM t",
output: "with t as (select 1) select * from t",
},
{
// https://github.com/dolthub/dolt/issues/8058
input: "select a from ((values (1, 2), ('a', 'b'))) as t (a, b)",
output: "select a from (values row(1, 2), row('a', 'b')) as t (a, b)",
},
{
input: "select a from (values (1, 2), ('a', 'b')) as t (a, b)",
output: "select a from (values row(1, 2), row('a', 'b')) as t (a, b)",
Expand Down Expand Up @@ -6148,6 +6183,18 @@ func TestInvalid(t *testing.T) {
input: "select a from (select * from tbl)",
err: "Every derived table must have its own alias",
},
{
input: "select a from ((select * from tbl))",
err: "Every derived table must have its own alias",
},
{
input: "select a from (((select * from tbl)))",
err: "Every derived table must have its own alias",
},
{
input: "select * from ((values (1, 2)))",
err: "Every derived table must have its own alias",
},
{
input: "select a, b from (select * from tbl) sort by a",
err: "syntax error",
Expand Down
Loading
Loading