Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit 690d0ec

Browse files
committed
order property of SELECT should be an array.
Whoops! `order` property of `SELECT` statements contained an object with a `result` key that contained the ordering list instead of just containing the ordering list. It should actually look like this instead:
1 parent 0d48351 commit 690d0ec

File tree

4 files changed

+35
-41
lines changed

4 files changed

+35
-41
lines changed

src/grammar.pegjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ stmt_core_order "ORDER BY Clause"
931931
= ORDER o BY o d:( stmt_core_order_list )
932932
{
933933
return {
934-
'order': d
934+
'order': d['result']
935935
};
936936
}
937937

test/json/expressions/with-table-expression-2.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,17 @@
6262
}
6363
}
6464
],
65-
"order": {
66-
"result": [
67-
{
68-
"type": "expression",
69-
"variant": "order",
70-
"expression": {
71-
"type": "identifier",
72-
"variant": "column",
73-
"name": "born"
74-
}
65+
"order": [
66+
{
67+
"type": "expression",
68+
"variant": "order",
69+
"expression": {
70+
"type": "identifier",
71+
"variant": "column",
72+
"name": "born"
7573
}
76-
]
77-
},
74+
}
75+
],
7876
"with": [
7977
{
8078
"type": "expression",

test/json/select/select-alt-syntax.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@
33
{
44
"type": "statement",
55
"variant": "select",
6-
"order": {
7-
"result": [
8-
{
9-
"type": "expression",
10-
"variant": "order",
11-
"expression": {
12-
"type": "identifier",
13-
"variant": "column",
14-
"name": "ham"
15-
},
16-
"direction": "desc"
17-
}
18-
]
19-
}
6+
"order": [
7+
{
8+
"type": "expression",
9+
"variant": "order",
10+
"expression": {
11+
"type": "identifier",
12+
"variant": "column",
13+
"name": "ham"
14+
},
15+
"direction": "desc"
16+
}
17+
]
2018
}
2119
]
2220
}

test/json/select/select-parts-1.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,18 @@
7070
"value": "200"
7171
}
7272
},
73-
"order": {
74-
"result": [
75-
{
76-
"type": "expression",
77-
"variant": "order",
78-
"expression": {
79-
"type": "identifier",
80-
"variant": "column",
81-
"name": "h.color"
82-
},
83-
"direction": "desc"
84-
}
85-
]
86-
},
73+
"order": [
74+
{
75+
"type": "expression",
76+
"variant": "order",
77+
"expression": {
78+
"type": "identifier",
79+
"variant": "column",
80+
"name": "h.color"
81+
},
82+
"direction": "desc"
83+
}
84+
],
8785
"limit": {
8886
"type": "expression",
8987
"variant": "limit",

0 commit comments

Comments
 (0)