Skip to content

Commit 9fbfb42

Browse files
authored
Merge pull request #29 from PeerDB-io/v41
merge 0.41.0
2 parents e2a651a + d4abd2b commit 9fbfb42

20 files changed

+977
-85
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ Given that the parser produces a typed AST, any changes to the AST will technica
99
Check https://github.com/sqlparser-rs/sqlparser-rs/commits/main for undocumented changes.
1010

1111

12+
## [0.41.0] 2023-12-22
13+
14+
### Added
15+
* Support `DEFERRED`, `IMMEDIATE`, and `EXCLUSIVE` in SQLite's `BEGIN TRANSACTION` command (#1067) - Thanks @takaebato
16+
* Support generated columns skipping `GENERATED ALWAYS` keywords (#1058) - Thanks @takluyver
17+
* Support `LOCK/UNLOCK TABLES` for MySQL (#1059) - Thanks @zzzdong
18+
* Support `JSON_TABLE` (#1062) - Thanks @lovasoa
19+
* Support `CALL` statements (#1063) - Thanks @lovasoa
20+
21+
### Fixed
22+
* fix rendering of SELECT TOP (#1070) for Snowflake - Thanks jmhain
23+
24+
### Changed
25+
* Improve documentation formatting (#1068) - Thanks @alamb
26+
* Replace type_id() by trait method to allow wrapping dialects (#1065) - Thanks @jjbayer
27+
* Document that comments aren't preserved for round trip (#1060) - Thanks @takluyver
28+
* Update sqlparser-derive to use `syn 2.0` (#1040) - Thanks @serprex
29+
1230
## [0.40.0] 2023-11-27
1331

1432
### Added

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "sqlparser"
33
description = "Extensible SQL Lexer and Parser with support for ANSI SQL:2011"
4-
version = "0.40.0"
4+
version = "0.41.0"
55
authors = ["Andy Grove <[email protected]>"]
66
homepage = "https://github.com/sqlparser-rs/sqlparser-rs"
77
documentation = "https://docs.rs/sqlparser/"

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ analysis, feel free to use this project as a base.
6161

6262
## Preserves Syntax Round Trip
6363

64-
This crate allows users to recover the original SQL text (with normalized
65-
whitespace and keyword capitalization), which is useful for tools that
66-
analyze and manipulate SQL.
64+
This crate allows users to recover the original SQL text (with comments removed,
65+
normalized whitespace and keyword capitalization), which is useful for tools
66+
that analyze and manipulate SQL.
6767

68-
This means that other than whitespace and the capitalization of keywords, the
69-
following should hold true for all SQL:
68+
This means that other than comments, whitespace and the capitalization of
69+
keywords, the following should hold true for all SQL:
7070

7171
```rust
7272
// Parse SQL

src/ast/ddl.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,8 @@ pub enum ColumnOption {
600600
sequence_options: Option<Vec<SequenceOptions>>,
601601
generation_expr: Option<Expr>,
602602
generation_expr_mode: Option<GeneratedExpressionMode>,
603+
/// false if 'GENERATED ALWAYS' is skipped (option starts with AS)
604+
generated_keyword: bool,
603605
},
604606
}
605607

@@ -641,14 +643,19 @@ impl fmt::Display for ColumnOption {
641643
sequence_options,
642644
generation_expr,
643645
generation_expr_mode,
646+
generated_keyword,
644647
} => {
645648
if let Some(expr) = generation_expr {
646649
let modifier = match generation_expr_mode {
647650
None => "",
648651
Some(GeneratedExpressionMode::Virtual) => " VIRTUAL",
649652
Some(GeneratedExpressionMode::Stored) => " STORED",
650653
};
651-
write!(f, "GENERATED ALWAYS AS ({expr}){modifier}")?;
654+
if *generated_keyword {
655+
write!(f, "GENERATED ALWAYS AS ({expr}){modifier}")?;
656+
} else {
657+
write!(f, "AS ({expr}){modifier}")?;
658+
}
652659
Ok(())
653660
} else {
654661
// Like Postgres - generated from sequence

0 commit comments

Comments
 (0)