Skip to content

Commit 436ca17

Browse files
committed
update sql parser
1 parent 389bad3 commit 436ca17

File tree

4 files changed

+92
-23
lines changed

4 files changed

+92
-23
lines changed

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,29 @@
3636
- Add a new `description_md` row-level property to the form component to allow displaying markdown in a form field description.
3737
- Improve the error message when a header component (e.g. status_code, json, cookie) is used in the wrong place (after data has already been sent to the client).
3838
- New function: [`sqlpage.headers`](https://sql-page.com/functions.sql?function=headers).
39+
- Updated sqlparser to [v0.54](https://github.com/apache/datafusion-sqlparser-rs/blob/main/changelog/0.54.0.md) which fixes parse errors when using some advanced SQL syntax
40+
- Add support for `INSERT INTO ... SELECT ... RETURNING` statements, like
41+
```sql
42+
INSERT INTO table1(x, y)
43+
SELECT :x, :y
44+
WHERE :x IS NOT NULL
45+
RETURNING
46+
'redirect' as component,
47+
'inserted.sql?id=' || id as link;
48+
```
49+
- Add support for PostgreSQL's `overlaps` operator, like
50+
```sql
51+
select 'card' as component;
52+
select event_name as title, start_time || ' - ' || end_time as description
53+
from events
54+
where (start_time, end_time) overlaps ($start_filter::timestamp, $end_filter::timestamp);
55+
```
56+
- Add support for MySQL's `INSERT INTO ... SET` syntax, like
57+
```sql
58+
insert into users
59+
set name = :name, email = :email
60+
```
61+
3962

4063
## 0.32.1 (2025-01-03)
4164

Cargo.lock

+63-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ anyhow = "1"
4242
serde = "1"
4343
serde_json = { version = "1.0.82", features = ["preserve_order", "raw_value"] }
4444
lambda-web = { version = "0.2.1", features = ["actix4"], optional = true }
45-
sqlparser = { version = "0.53.0", features = ["visitor"] }
45+
sqlparser = { version = "0.54.0", features = ["visitor"] }
4646
async-stream = "0.3"
4747
async-trait = "0.1.61"
4848
async-recursion = "1.0.0"

src/webserver/database/sql_to_json.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ mod tests {
185185
INTERVAL '4 hours' as hour_interval,
186186
INTERVAL '1.5 days' as fractional_interval,
187187
'{\"key\": \"value\"}'::JSON as json,
188-
'{\"key\": \"value\"}'::JSONB as jsonb",
188+
'{\"key\": \"value\"}'::JSONB as jsonb,
189+
age('2024-03-14'::timestamp, '2024-01-01'::timestamp) as age_interval,
190+
justify_interval(interval '1 year 2 months 3 days') as justified_interval",
189191
)
190192
.fetch_one(&mut c)
191193
.await?;
@@ -208,6 +210,8 @@ mod tests {
208210
"fractional_interval": "1 day 12:00:00",
209211
"json": {"key": "value"},
210212
"jsonb": {"key": "value"},
213+
"age_interval": "2 mons 13 days",
214+
"justified_interval": "1 year 2 mons 3 days"
211215
}),
212216
);
213217
Ok(())

0 commit comments

Comments
 (0)