Skip to content

Commit ab1155c

Browse files
author
James Cor
committed
move tests
1 parent 5267c09 commit ab1155c

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

enginetest/queries/script_queries.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7782,32 +7782,6 @@ where
77827782
},
77837783
},
77847784
},
7785-
{
7786-
Name: "group by ordinal tests",
7787-
Dialect: "mysql",
7788-
SetUpScript: []string{
7789-
"create table t (i int, j int);",
7790-
},
7791-
Assertions: []ScriptTestAssertion{
7792-
{
7793-
Query: "select 1 from t group by 'abc';",
7794-
ExpectedErrStr: "expected integer order by literal",
7795-
},
7796-
{
7797-
// TODO: this actually works in MySQL
7798-
Query: "select 1 from t group by -123;",
7799-
ExpectedErrStr: "expected positive integer order by literal",
7800-
},
7801-
{
7802-
Query: "select 1 from t group by 0;",
7803-
ExpectedErrStr: "expected positive integer order by literal",
7804-
},
7805-
{
7806-
Query: "select 1 from t group by 100;",
7807-
ExpectedErrStr: "column ordinal out of range: 100",
7808-
},
7809-
},
7810-
},
78117785
}
78127786

78137787
var SpatialScriptTests = []ScriptTest{

sql/planbuilder/parse_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,6 +2950,25 @@ func TestPlanBuilderErr(t *testing.T) {
29502950
Query: "select x + 1 as xx from xy join uv on (x = u) having x = 123;",
29512951
Err: "column \"x\" could not be found in any table in scope",
29522952
},
2953+
2954+
// Test GroupBy Ordinals
2955+
{
2956+
Query: "select 1 from xy group by 'abc';",
2957+
Err: "expected integer order by literal",
2958+
},
2959+
{
2960+
// TODO: this actually works in MySQL
2961+
Query: "select 1 from xy group by -123;",
2962+
Err: "expected positive integer order by literal",
2963+
},
2964+
{
2965+
Query: "select 1 from xy group by 0;",
2966+
Err: "expected positive integer order by literal",
2967+
},
2968+
{
2969+
Query: "select 1 from xy group by 100;",
2970+
Err: "column ordinal out of range: 100",
2971+
},
29532972
}
29542973

29552974
db := memory.NewDatabase("mydb")

0 commit comments

Comments
 (0)