Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
17f2930
Introduce support for EXPLAIN [ANALYZE] [VERBOSE] <STATEMENT> syntax
ovr Dec 28, 2020
94ff468
Support ANALYZE TABLE syntax (#285)
Dandandan Dec 28, 2020
e18e8dc
Prepare 0.6.2
Dandandan Dec 28, 2020
d66294f
Add date
Dandandan Dec 28, 2020
26c281e
(cargo-release) version 0.6.2
Dandandan Dec 28, 2020
9930bdf
(cargo-release) start next development iteration 0.6.3-alpha.0
Dandandan Dec 28, 2020
97cd1c0
Release 0.7.0 instead
Dandandan Dec 28, 2020
e11b80e
(cargo-release) version 0.7.0
Dandandan Dec 28, 2020
200ed5e
(cargo-release) start next development iteration 0.7.1-alpha.0
Dandandan Dec 28, 2020
17f8eb9
Fix clippy lints (#287)
joshwd36 Jan 7, 2021
8a214f9
Implement Hive QL Parsing (#235)
hntd187 Feb 4, 2021
6f0b2dc
Implement SUBSTRING(col [FROM <expr>] [FOR <expr>]) syntax (#293)
Dandandan Feb 7, 2021
f40955e
Parse floats without leading number (#294)
Dandandan Feb 8, 2021
07342d5
Support parsing multiple show variables. (#290)
francis-du Feb 9, 2021
add8991
feat: support sqlite insert or statement (#281)
zhangli-pear Feb 9, 2021
a868ff6
Add release notes
Dandandan Feb 9, 2021
34cd794
(cargo-release) version 0.8.0
Dandandan Feb 9, 2021
43fef23
(cargo-release) start next development iteration 0.8.1-alpha.0
Dandandan Feb 9, 2021
e6e37b4
Implement TRY_CAST (#299)
seddonm1 Mar 21, 2021
c2340d1
Add release notes for 0.8.0
Dandandan Mar 21, 2021
f52891d
(cargo-release) version 0.9.0
Dandandan Mar 21, 2021
1e87ab8
(cargo-release) start next development iteration 0.9.1-alpha.0
Dandandan Mar 21, 2021
a9e6f77
provide ILIKE support
maxcountryman Mar 20, 2021
35ef0ee
Merge pull request #300 from maxcountryman/feature/ilike
maxcountryman Mar 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ Given that the parser produces a typed AST, any changes to the AST will technica
## [Unreleased]
Check https://github.com/ballista-compute/sqlparser-rs/commits/main for undocumented changes.


## [0.8.0] 2020-03-21

### Added
* Add support for `TRY_CAST` syntax (#299) - Thanks @seddonm1!

## [0.8.0] 2020-02-20

### Added
* Introduce Hive QL dialect `HiveDialect` and syntax (#235) - Thanks @hntd187!
* Add `SUBSTRING(col [FROM <expr>] [FOR <expr>])` syntax (#293)
* Support parsing floats without leading digits `.01` (#294)
* Support parsing multiple show variables (#290) - Thanks @francis-du!
* Support SQLite `INSERT OR [..]` syntax (#281) - Thanks @zhangli-pear!

## [0.7.0] 2020-12-28

### Changed
- Change the MySQL dialect to support `` `identifiers` `` quoted with backticks instead of the standard `"double-quoted"` identifiers (#247) - thanks @mashuai!
- Update bigdecimal requirement from 0.1 to 0.2 (#268)
Expand All @@ -21,6 +38,10 @@ Check https://github.com/ballista-compute/sqlparser-rs/commits/main for undocume
- Support PostgreSQL math operators (#267) - thanks @alex-dukhno!
- Add SQLite dialect (#248) - thanks @mashuai!
- Add Snowflake dialect (#259) - thanks @eyalleshem!
- Support for Recursive CTEs - thanks @rhanqtl!
- Support `FROM (table_name) alias` syntax - thanks @eyalleshem!
- Support for `EXPLAIN [ANALYZE] VERBOSE` - thanks @ovr!
- Support `ANALYZE TABLE`
- DDL:
- Support `OR REPLACE` in `CREATE VIEW`/`TABLE` (#239) - thanks @Dandandan!
- Support specifying `ASC`/`DESC` in index columns (#249) - thanks @mashuai!
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sqlparser"
description = "Extensible SQL Lexer and Parser with support for ANSI SQL:2011"
version = "0.6.1"
version = "0.9.1-alpha.0"
authors = ["Andy Grove <andygrove73@gmail.com>"]
homepage = "https://github.com/ballista-compute/sqlparser-rs"
documentation = "https://docs.rs/sqlparser/"
Expand Down
1 change: 1 addition & 0 deletions examples/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ $ cargo run --feature json_example --example cli FILENAME.sql [--dialectname]
"--postgres" => Box::new(PostgreSqlDialect {}),
"--ms" => Box::new(MsSqlDialect {}),
"--snowflake" => Box::new(SnowflakeDialect {}),
"--hive" => Box::new(HiveDialect {}),
"--generic" | "" => Box::new(GenericDialect {}),
s => panic!("Unexpected parameter: {}", s),
};
Expand Down
3 changes: 3 additions & 0 deletions src/ast/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ pub enum DataType {
Regclass,
/// Text
Text,
/// String
String,
/// Bytea
Bytea,
/// Custom type such as enums
Expand Down Expand Up @@ -101,6 +103,7 @@ impl fmt::Display for DataType {
DataType::Interval => write!(f, "INTERVAL"),
DataType::Regclass => write!(f, "REGCLASS"),
DataType::Text => write!(f, "TEXT"),
DataType::String => write!(f, "STRING"),
DataType::Bytea => write!(f, "BYTEA"),
DataType::Array(ty) => write!(f, "{}[]", ty),
DataType::Custom(ty) => write!(f, "{}", ty),
Expand Down
45 changes: 43 additions & 2 deletions src/ast/ddl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,54 @@ pub enum AlterTableOperation {
if_exists: bool,
cascade: bool,
},
/// `RENAME TO PARTITION (partition=val)`
RenamePartitions {
old_partitions: Vec<Expr>,
new_partitions: Vec<Expr>,
},
/// Add Partitions
AddPartitions {
if_not_exists: bool,
new_partitions: Vec<Expr>,
},
DropPartitions {
partitions: Vec<Expr>,
if_exists: bool,
},
/// `RENAME [ COLUMN ] <old_column_name> TO <new_column_name>`
RenameColumn {
old_column_name: Ident,
new_column_name: Ident,
},
/// `RENAME TO <table_name>`
RenameTable { table_name: Ident },
RenameTable { table_name: ObjectName },
}

impl fmt::Display for AlterTableOperation {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
AlterTableOperation::AddPartitions {
if_not_exists,
new_partitions,
} => write!(
f,
"ADD{ine} PARTITION ({})",
display_comma_separated(new_partitions),
ine = if *if_not_exists { " IF NOT EXISTS" } else { "" }
),
AlterTableOperation::AddConstraint(c) => write!(f, "ADD {}", c),
AlterTableOperation::AddColumn { column_def } => {
write!(f, "ADD COLUMN {}", column_def.to_string())
}
AlterTableOperation::DropPartitions {
partitions,
if_exists,
} => write!(
f,
"DROP{ie} PARTITION ({})",
display_comma_separated(partitions),
ie = if *if_exists { " IF EXISTS" } else { "" }
),
AlterTableOperation::DropConstraint { name } => write!(f, "DROP CONSTRAINT {}", name),
AlterTableOperation::DropColumn {
column_name,
Expand All @@ -63,6 +95,15 @@ impl fmt::Display for AlterTableOperation {
column_name,
if *cascade { " CASCADE" } else { "" }
),
AlterTableOperation::RenamePartitions {
old_partitions,
new_partitions,
} => write!(
f,
"PARTITION ({}) RENAME TO PARTITION ({})",
display_comma_separated(old_partitions),
display_comma_separated(new_partitions)
),
AlterTableOperation::RenameColumn {
old_column_name,
new_column_name,
Expand Down Expand Up @@ -254,7 +295,7 @@ impl fmt::Display for ColumnOption {
}
}

fn display_constraint_name<'a>(name: &'a Option<Ident>) -> impl fmt::Display + 'a {
fn display_constraint_name(name: &'_ Option<Ident>) -> impl fmt::Display + '_ {
struct ConstraintName<'a>(&'a Option<Ident>);
impl<'a> fmt::Display for ConstraintName<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down
Loading