You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 15, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+208-1Lines changed: 208 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,212 @@ All notable changes to this project will be documented in this file.
3
3
4
4
## [Unreleased][unreleased]
5
5
6
+
## [v1.0.0-rc2] - 2016-10-30
7
+
### Changed
8
+
-**BREAKING CHANGE** All named values for properties such as `variant`, `format`, and `type` should always be lowercase, even when uppercase in the input SQL (e.g., `variant` is now `natural join` instead of `NATURAL JOIN` in the AST).
9
+
10
+
-**BREAKING CHANGE** New format for `CASE` expression AST nodes:
11
+
-`variant``when` has a `condition` and a `consequent`
12
+
-`variant``else` has just a `consequent`
13
+
- the outer `expression` is now `variant``case` instead of `binary`
14
+
- instead of taking whatever is provided between `CASE` and `WHEN` (e.g., `CASE foo WHEN ...`) and calling that the expression, it is now added as the `discriminant`
15
+
16
+
```sql
17
+
select
18
+
case acc
19
+
when a =0 then a1
20
+
when a =1 then b1
21
+
else c1
22
+
end
23
+
```
24
+
25
+
```json
26
+
{
27
+
"type": "expression",
28
+
"variant": "case",
29
+
"expression": [
30
+
{
31
+
"type": "condition",
32
+
"variant": "when",
33
+
"condition": {
34
+
"type": "expression",
35
+
"format": "binary",
36
+
"variant": "operation",
37
+
"operation": "=",
38
+
"left": {
39
+
"type": "identifier",
40
+
"variant": "column",
41
+
"name": "a"
42
+
},
43
+
"right": {
44
+
"type": "literal",
45
+
"variant": "decimal",
46
+
"value": "0"
47
+
}
48
+
},
49
+
"consequent": {
50
+
"type": "identifier",
51
+
"variant": "column",
52
+
"name": "a1"
53
+
}
54
+
},
55
+
{
56
+
"type": "condition",
57
+
"variant": "when",
58
+
"condition": {
59
+
"type": "expression",
60
+
"format": "binary",
61
+
"variant": "operation",
62
+
"operation": "=",
63
+
"left": {
64
+
"type": "identifier",
65
+
"variant": "column",
66
+
"name": "a"
67
+
},
68
+
"right": {
69
+
"type": "literal",
70
+
"variant": "decimal",
71
+
"value": "1"
72
+
}
73
+
},
74
+
"consequent": {
75
+
"type": "identifier",
76
+
"variant": "column",
77
+
"name": "b1"
78
+
}
79
+
},
80
+
{
81
+
"type": "condition",
82
+
"variant": "else",
83
+
"consequent": {
84
+
"type": "identifier",
85
+
"variant": "column",
86
+
"name": "c1"
87
+
}
88
+
}
89
+
],
90
+
"discriminant": {
91
+
"type": "identifier",
92
+
"variant": "column",
93
+
"name": "acc"
94
+
}
95
+
}
96
+
```
97
+
98
+
-**BREAKING CHANGE** New format for `EXISTS` expression nodes. Use `expression` node in `condition` for `IF NOT EXISTS`. `NOT EXISTS`, and `EXISTS` modifiers instead of a string value.
99
+
-`CREATE TABLE` statement
100
+
101
+
```sql
102
+
createtableif not exists foo(id int)
103
+
```
104
+
105
+
``` json
106
+
{
107
+
"type": "statement",
108
+
"name": {
109
+
"type": "identifier",
110
+
"variant": "table",
111
+
"name": "foo"
112
+
},
113
+
"variant": "create",
114
+
"format": "table",
115
+
"definition": [
116
+
{
117
+
"type": "definition",
118
+
"variant": "column",
119
+
"name": "id",
120
+
"definition": [],
121
+
"datatype": {
122
+
"type": "datatype",
123
+
"variant": "int",
124
+
"affinity": "integer"
125
+
}
126
+
}
127
+
],
128
+
"condition": [
129
+
{
130
+
"type": "condition",
131
+
"variant": "if",
132
+
"condition": {
133
+
"type": "expression",
134
+
"variant": "exists",
135
+
"operator": "not exists"
136
+
}
137
+
}
138
+
]
139
+
}
140
+
```
141
+
142
+
-`DROP TABLE` statement
143
+
144
+
``` sql
145
+
drop table if exists foo
146
+
```
147
+
148
+
``` json
149
+
{
150
+
"type": "statement",
151
+
"target": {
152
+
"type": "identifier",
153
+
"variant": "table",
154
+
"name": "foo"
155
+
},
156
+
"variant": "drop",
157
+
"format": "table",
158
+
"condition": [
159
+
{
160
+
"type": "condition",
161
+
"variant": "if",
162
+
"condition": {
163
+
"type": "expression",
164
+
"variant": "exists",
165
+
"operator": "exists"
166
+
}
167
+
}
168
+
]
169
+
}
170
+
```
171
+
172
+
-`NOT EXISTS` expression
173
+
174
+
``` sql
175
+
select a
176
+
where not exists (select b)
177
+
```
178
+
179
+
``` json
180
+
{
181
+
"type": "statement",
182
+
"variant": "select",
183
+
"result": [
184
+
{
185
+
"type": "identifier",
186
+
"variant": "column",
187
+
"name": "a"
188
+
}
189
+
],
190
+
"where": [
191
+
{
192
+
"type": "expression",
193
+
"format": "unary",
194
+
"variant": "exists",
195
+
"expression": {
196
+
"type": "statement",
197
+
"variant": "select",
198
+
"result": [
199
+
{
200
+
"type": "identifier",
201
+
"variant": "column",
202
+
"name": "b"
203
+
}
204
+
]
205
+
},
206
+
"operator": "not exists"
207
+
}
208
+
]
209
+
}
210
+
```
211
+
6
212
## [v1.0.0-rc1] - 2016-10-16
7
213
### Added
8
214
- The root node of the AST now has `type`and`variant` properties:
@@ -1032,7 +1238,8 @@ part of table names, column names, aliases, etc... This also addresses issues th
0 commit comments