-
Notifications
You must be signed in to change notification settings - Fork 750
Expand file tree
/
Copy pathselect.yaml
More file actions
233 lines (233 loc) · 24.8 KB
/
select.yaml
File metadata and controls
233 lines (233 loc) · 24.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# This file is automatically generated by `src/sqlparser/tests/parser_test.rs`.
- input: SELECT sqrt(id) FROM foo
formatted_sql: SELECT sqrt(id) FROM foo
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Function(Function { name: ObjectName([Ident { value: "sqrt", quote_style: None }]), args: [Unnamed(Expr(Identifier(Ident { value: "id", quote_style: None })))], variadic: false, over: None, distinct: false, order_by: [], filter: None, within_group: None }))], from: [TableWithJoins { relation: Table { name: ObjectName([Ident { value: "foo", quote_style: None }]), alias: None, as_of: None }, joins: [] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT INT '1'
formatted_sql: SELECT INT '1'
- input: SELECT (foo).v1.v2 FROM foo
formatted_sql: SELECT (foo).v1.v2 FROM foo
- input: SELECT ((((foo).v1)).v2) FROM foo
formatted_sql: SELECT (((foo).v1).v2) FROM foo
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Nested(FieldIdentifier(FieldIdentifier(Identifier(Ident { value: "foo", quote_style: None }), [Ident { value: "v1", quote_style: None }]), [Ident { value: "v2", quote_style: None }])))], from: [TableWithJoins { relation: Table { name: ObjectName([Ident { value: "foo", quote_style: None }]), alias: None, as_of: None }, joins: [] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT (foo.v1).v2 FROM foo
formatted_sql: SELECT (foo.v1).v2 FROM foo
- input: SELECT (v1).v2 FROM foo
formatted_sql: SELECT (v1).v2 FROM foo
- input: SELECT ((1,2,3)::foo).v1
formatted_sql: SELECT (CAST(ROW(1, 2, 3) AS foo)).v1
- input: SELECT ((1,2,3)::foo).v1.v2
formatted_sql: SELECT (CAST(ROW(1, 2, 3) AS foo)).v1.v2
- input: SELECT (((1,2,3)::foo).v1).v2
formatted_sql: SELECT ((CAST(ROW(1, 2, 3) AS foo)).v1).v2
- input: SELECT (foo).* FROM foo
formatted_sql: SELECT (foo).* FROM foo
- input: SELECT ((foo.v1).v2).* FROM foo
formatted_sql: SELECT (foo.v1).v2.* FROM foo
- input: SELECT ((1,2,3)::foo).v1.*
formatted_sql: SELECT (CAST(ROW(1, 2, 3) AS foo)).v1.*
- input: SELECT (((((1,2,3)::foo).v1))).*
formatted_sql: SELECT (CAST(ROW(1, 2, 3) AS foo)).v1.*
- input: SELECT * FROM generate_series('2'::INT,'10'::INT,'2'::INT)
formatted_sql: SELECT * FROM generate_series(CAST('2' AS INT), CAST('10' AS INT), CAST('2' AS INT))
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [Wildcard(None)], from: [TableWithJoins { relation: TableFunction { name: ObjectName([Ident { value: "generate_series", quote_style: None }]), alias: None, args: [Unnamed(Expr(Cast { expr: Value(SingleQuotedString("2")), data_type: Int })), Unnamed(Expr(Cast { expr: Value(SingleQuotedString("10")), data_type: Int })), Unnamed(Expr(Cast { expr: Value(SingleQuotedString("2")), data_type: Int }))], with_ordinality: false }, joins: [] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT * FROM unnest(Array[1,2,3]);
formatted_sql: SELECT * FROM unnest(ARRAY[1, 2, 3])
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [Wildcard(None)], from: [TableWithJoins { relation: TableFunction { name: ObjectName([Ident { value: "unnest", quote_style: None }]), alias: None, args: [Unnamed(Expr(Array(Array { elem: [Value(Number("1")), Value(Number("2")), Value(Number("3"))], named: true })))], with_ordinality: false }, joins: [] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT id, fname, lname FROM customer WHERE salary <> 'Not Provided' AND salary <> ''
formatted_sql: SELECT id, fname, lname FROM customer WHERE salary <> 'Not Provided' AND salary <> ''
- input: SELECT id FROM customer WHERE NOT salary = ''
formatted_sql: SELECT id FROM customer WHERE NOT salary = ''
- input: SELECT * EXCEPT (v1,v2) FROM foo
formatted_sql: SELECT * EXCEPT (v1, v2) FROM foo
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [Wildcard(Some([Identifier(Ident { value: "v1", quote_style: None }), Identifier(Ident { value: "v2", quote_style: None })]))], from: [TableWithJoins { relation: Table { name: ObjectName([Ident { value: "foo", quote_style: None }]), alias: None, as_of: None }, joins: [] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT foo.* EXCEPT (foo.v1, bar.v2) FROM foo, bar
formatted_sql: SELECT foo.* EXCEPT (foo.v1, bar.v2) FROM foo, bar
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [QualifiedWildcard(ObjectName([Ident { value: "foo", quote_style: None }]), Some([CompoundIdentifier([Ident { value: "foo", quote_style: None }, Ident { value: "v1", quote_style: None }]), CompoundIdentifier([Ident { value: "bar", quote_style: None }, Ident { value: "v2", quote_style: None }])]))], from: [TableWithJoins { relation: Table { name: ObjectName([Ident { value: "foo", quote_style: None }]), alias: None, as_of: None }, joins: [] }, TableWithJoins { relation: Table { name: ObjectName([Ident { value: "bar", quote_style: None }]), alias: None, as_of: None }, joins: [] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT * EXCEPT (v1), bar.* EXCEPT (foo.v2) FROM foo, bar
formatted_sql: SELECT * EXCEPT (v1), bar.* EXCEPT (foo.v2) FROM foo, bar
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [Wildcard(Some([Identifier(Ident { value: "v1", quote_style: None })])), QualifiedWildcard(ObjectName([Ident { value: "bar", quote_style: None }]), Some([CompoundIdentifier([Ident { value: "foo", quote_style: None }, Ident { value: "v2", quote_style: None }])]))], from: [TableWithJoins { relation: Table { name: ObjectName([Ident { value: "foo", quote_style: None }]), alias: None, as_of: None }, joins: [] }, TableWithJoins { relation: Table { name: ObjectName([Ident { value: "bar", quote_style: None }]), alias: None, as_of: None }, joins: [] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT v3 EXCEPT (v1, v2) FROM foo
error_msg: |-
sql parser error: expected SELECT, VALUES, or a subquery in the query body, found: v1
LINE 1: SELECT v3 EXCEPT (v1, v2) FROM foo
^
- input: SELECT * EXCEPT (V1, ) FROM foo
error_msg: |-
sql parser error: expected an expression, found: )
LINE 1: SELECT * EXCEPT (V1, ) FROM foo
^
- input: SELECT * EXCEPT (v1 FROM foo
error_msg: |-
sql parser error: expected ( should be followed by ) after column names, found: FROM
LINE 1: SELECT * EXCEPT (v1 FROM foo
^
- input: SELECT * FROM t LIMIT 1 FETCH FIRST ROWS ONLY
error_msg: |-
sql parser error: Cannot specify both LIMIT and FETCH
LINE 1: SELECT * FROM t LIMIT 1 FETCH FIRST ROWS ONLY
^
- input: SELECT * FROM t FETCH FIRST ROWS WITH TIES
error_msg: |-
sql parser error: WITH TIES cannot be specified without ORDER BY clause
LINE 1: SELECT * FROM t FETCH FIRST ROWS WITH TIES
^
- input: select * from (select 1 from 1);
error_msg: |-
sql parser error: expected identifier, found: 1
LINE 1: select * from (select 1 from 1);
^
- input: select * from (select * from tumble(t, x, interval '10' minutes))
error_msg: |-
sql parser error: expected ), found: minutes
LINE 1: select * from (select * from tumble(t, x, interval '10' minutes))
^
- input: SELECT 1, FROM t
error_msg: |-
sql parser error: syntax error at or near FROM at line 1, column 11
LINE 1: SELECT 1, FROM t
^
- input: SELECT 1, WHERE true
error_msg: |-
sql parser error: syntax error at or near WHERE at line 1, column 11
LINE 1: SELECT 1, WHERE true
^
- input: SELECT timestamp with time zone '2022-10-01 12:00:00Z' AT TIME ZONE 'US/Pacific'
formatted_sql: SELECT TIMESTAMP WITH TIME ZONE '2022-10-01 12:00:00Z' AT TIME ZONE 'US/Pacific'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(AtTimeZone { timestamp: TypedString { data_type: Timestamp(true), value: "2022-10-01 12:00:00Z" }, time_zone: Value(SingleQuotedString("US/Pacific")) })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT timestamp with time zone '2022-10-01 12:00:00Z' AT TIME ZONE zone
formatted_sql: SELECT TIMESTAMP WITH TIME ZONE '2022-10-01 12:00:00Z' AT TIME ZONE zone
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(AtTimeZone { timestamp: TypedString { data_type: Timestamp(true), value: "2022-10-01 12:00:00Z" }, time_zone: Identifier(Ident { value: "zone", quote_style: None }) })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT now() + INTERVAL '14 days' AT TIME ZONE 'UTC'; -- https://www.postgresql.org/message-id/CADT4RqBPdbsZW7HS1jJP319TMRHs1hzUiP=iRJYR6UqgHCrgNQ@mail.gmail.com
formatted_sql: SELECT now() + INTERVAL '14 days' AT TIME ZONE 'UTC'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(BinaryOp { left: Function(Function { name: ObjectName([Ident { value: "now", quote_style: None }]), args: [], variadic: false, over: None, distinct: false, order_by: [], filter: None, within_group: None }), op: Plus, right: AtTimeZone { timestamp: Value(Interval { value: "14 days", leading_field: None, leading_precision: None, last_field: None, fractional_seconds_precision: None }), time_zone: Value(SingleQuotedString("UTC")) } })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT c FROM t WHERE c >= '2019-03-27T22:00:00.000Z'::timestamp AT TIME ZONE 'Europe/Brussels'; -- https://github.com/sqlparser-rs/sqlparser-rs/issues/1266
formatted_sql: SELECT c FROM t WHERE c >= CAST('2019-03-27T22:00:00.000Z' AS TIMESTAMP) AT TIME ZONE 'Europe/Brussels'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Identifier(Ident { value: "c", quote_style: None }))], from: [TableWithJoins { relation: Table { name: ObjectName([Ident { value: "t", quote_style: None }]), alias: None, as_of: None }, joins: [] }], lateral_views: [], selection: Some(BinaryOp { left: Identifier(Ident { value: "c", quote_style: None }), op: GtEq, right: AtTimeZone { timestamp: Cast { expr: Value(SingleQuotedString("2019-03-27T22:00:00.000Z")), data_type: Timestamp(false) }, time_zone: Value(SingleQuotedString("Europe/Brussels")) } }), group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT 0c6
error_msg: |-
sql parser error: trailing junk after numeric literal at line 1, column 9
LINE 1: SELECT 0c6
^
- input: SELECT 1e6
formatted_sql: SELECT 1e6
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("1e6")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT 1.25E6
formatted_sql: SELECT 1.25e6
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("1.25e6")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT 1e-6
formatted_sql: SELECT 1e-6
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("1e-6")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT -1e6
formatted_sql: SELECT -1e6
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("-1e6")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT 0x42e3
formatted_sql: SELECT 0x42e3
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("0x42e3")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT -0X40
formatted_sql: SELECT -0x40
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("-0x40")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT 0B1101
formatted_sql: SELECT 0b1101
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("0b1101")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT -0b101
formatted_sql: SELECT -0b101
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("-0b101")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT 0o664
formatted_sql: SELECT 0o664
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("0o664")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT -0O755
formatted_sql: SELECT -0o755
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Value(Number("-0o755")))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: SELECT 0o129
error_msg: |-
sql parser error: expected end of statement, found: 9
LINE 1: SELECT 0o129
^
- input: SELECT 0o3.5
error_msg: |-
sql parser error: expected end of statement, found: .5
LINE 1: SELECT 0o3.5
^
- input: SELECT 0x
error_msg: |-
sql parser error: incomplete integer literal at line 1, column 10
LINE 1: SELECT 0x
^
- input: SELECT 1::float(0)
error_msg: |-
sql parser error: invalid data_type: precision must be in range 1..54
LINE 1: SELECT 1::float(0)
^
- input: SELECT 1::float(54)
error_msg: |-
sql parser error: invalid data_type: precision must be in range 1..54
LINE 1: SELECT 1::float(54)
^
- input: SELECT 1::int(2)
error_msg: |-
sql parser error: expected end of statement, found: (
LINE 1: SELECT 1::int(2)
^
- input: select id1, a1, id2, a2 from stream as S join version FOR SYSTEM_TIME AS OF PROCTIME() AS V on id1= id2
formatted_sql: SELECT id1, a1, id2, a2 FROM stream AS S JOIN version FOR SYSTEM_TIME AS OF PROCTIME() AS V ON id1 = id2
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Identifier(Ident { value: "id1", quote_style: None })), UnnamedExpr(Identifier(Ident { value: "a1", quote_style: None })), UnnamedExpr(Identifier(Ident { value: "id2", quote_style: None })), UnnamedExpr(Identifier(Ident { value: "a2", quote_style: None }))], from: [TableWithJoins { relation: Table { name: ObjectName([Ident { value: "stream", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "S", quote_style: None }, columns: [] }), as_of: None }, joins: [Join { relation: Table { name: ObjectName([Ident { value: "version", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "V", quote_style: None }, columns: [] }), as_of: Some(ProcessTime) }, join_operator: Inner(On(BinaryOp { left: Identifier(Ident { value: "id1", quote_style: None }), op: Eq, right: Identifier(Ident { value: "id2", quote_style: None }) })) }] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select percentile_cont(0.3) within group (order by x desc) from unnest(array[1,2,4,5,10]) as x
formatted_sql: SELECT percentile_cont(0.3) FROM unnest(ARRAY[1, 2, 4, 5, 10]) AS x
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Function(Function { name: ObjectName([Ident { value: "percentile_cont", quote_style: None }]), args: [Unnamed(Expr(Value(Number("0.3"))))], variadic: false, over: None, distinct: false, order_by: [], filter: None, within_group: Some(OrderByExpr { expr: Identifier(Ident { value: "x", quote_style: None }), asc: Some(false), nulls_first: None }) }))], from: [TableWithJoins { relation: TableFunction { name: ObjectName([Ident { value: "unnest", quote_style: None }]), alias: Some(TableAlias { name: Ident { value: "x", quote_style: None }, columns: [] }), args: [Unnamed(Expr(Array(Array { elem: [Value(Number("1")), Value(Number("2")), Value(Number("4")), Value(Number("5")), Value(Number("10"))], named: true })))], with_ordinality: false }, joins: [] }], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select percentile_cont(0.3) within group (order by x, y desc) from t
error_msg: |-
sql parser error: expected ), found: ,
LINE 1: select percentile_cont(0.3) within group (order by x, y desc) from t
^
- input: select 'apple' ~~ 'app%'
formatted_sql: SELECT 'apple' ~~ 'app%'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(BinaryOp { left: Value(SingleQuotedString("apple")), op: PGLikeMatch, right: Value(SingleQuotedString("app%")) })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select 'apple' ~~* 'App%'
formatted_sql: SELECT 'apple' ~~* 'App%'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(BinaryOp { left: Value(SingleQuotedString("apple")), op: PGILikeMatch, right: Value(SingleQuotedString("App%")) })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select 'apple' !~~ 'app%'
formatted_sql: SELECT 'apple' !~~ 'app%'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(BinaryOp { left: Value(SingleQuotedString("apple")), op: PGNotLikeMatch, right: Value(SingleQuotedString("app%")) })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select 'apple' !~~* 'app%'
formatted_sql: SELECT 'apple' !~~* 'app%'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(BinaryOp { left: Value(SingleQuotedString("apple")), op: PGNotILikeMatch, right: Value(SingleQuotedString("app%")) })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select '123' IS JSON;
formatted_sql: SELECT '123' IS JSON
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(IsJson { expr: Value(SingleQuotedString("123")), negated: false, item_type: Value, unique_keys: false })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select '123' IS JSON VALUE WITHOUT UNIQUE KEYS;
formatted_sql: SELECT '123' IS JSON
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(IsJson { expr: Value(SingleQuotedString("123")), negated: false, item_type: Value, unique_keys: false })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select '123' IS NOT JSON ARRAY WITH UNIQUE KEYS;
formatted_sql: SELECT '123' IS NOT JSON ARRAY WITH UNIQUE KEYS
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(IsJson { expr: Value(SingleQuotedString("123")), negated: true, item_type: Array, unique_keys: true })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select '123' IS NOT JSON OBJECT WITH UNIQUE;
formatted_sql: SELECT '123' IS NOT JSON OBJECT WITH UNIQUE KEYS
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(IsJson { expr: Value(SingleQuotedString("123")), negated: true, item_type: Object, unique_keys: true })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select '123' IS NOT JSON SCALAR WITHOUT UNIQUE;
formatted_sql: SELECT '123' IS NOT JSON SCALAR
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(IsJson { expr: Value(SingleQuotedString("123")), negated: true, item_type: Scalar, unique_keys: false })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select 'a' like 'a';
formatted_sql: SELECT 'a' LIKE 'a'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Like { negated: false, expr: Value(SingleQuotedString("a")), pattern: Value(SingleQuotedString("a")), escape_char: None })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select 'a' like 'a' escape '\';
formatted_sql: SELECT 'a' LIKE 'a' ESCAPE '\'
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Like { negated: false, expr: Value(SingleQuotedString("a")), pattern: Value(SingleQuotedString("a")), escape_char: Some(EscapeChar(Some(''\\''))) })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select 'a' not like ANY(array['a', null]);
formatted_sql: SELECT 'a' NOT LIKE SOME(ARRAY['a', NULL])
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Like { negated: true, expr: Value(SingleQuotedString("a")), pattern: SomeOp(Array(Array { elem: [Value(SingleQuotedString("a")), Value(Null)], named: true })), escape_char: None })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: selet 1;
error_msg: |-
sql parser error: expected statement, found: selet
LINE 1: selet 1;
^
- input: select date t::date; -- https://github.com/risingwavelabs/risingwave/issues/17461
error_msg: |-
sql parser error: expected end of statement, found: ::
LINE 1: select date t::date; -- https://github.com/risingwavelabs/risingwave/issues/17461
^
- input: select date 't'::date; -- TypedString higher precedence than Cast
formatted_sql: SELECT CAST(DATE 't' AS DATE)
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Cast { expr: TypedString { data_type: Date, value: "t" }, data_type: Date })], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'
- input: select date t; -- A column "date" aliased to "t"
formatted_sql: SELECT date AS t
formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [ExprWithAlias { expr: Identifier(Ident { value: "date", quote_style: None }), alias: Ident { value: "t", quote_style: None } }], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })'