WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 699ce46

Browse files
Merge branch 'main' into alter-operator
2 parents 08e0a70 + effaac5 commit 699ce46

File tree

12 files changed

+213
-10
lines changed

12 files changed

+213
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
[package]
1919
name = "sqlparser"
2020
description = "Extensible SQL Lexer and Parser with support for ANSI SQL:2011"
21-
version = "0.59.0"
21+
version = "0.60.0"
2222
authors = ["Apache DataFusion <[email protected]>"]
2323
homepage = "https://github.com/apache/datafusion-sqlparser-rs"
2424
documentation = "https://docs.rs/sqlparser/"

changelog/0.60.0.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
20+
# sqlparser-rs 0.60.0 Changelog
21+
22+
This release consists of 37 commits from 20 contributors. See credits at the end of this changelog for more information.
23+
24+
**Implemented enhancements:**
25+
26+
- feat: Add RESET to the base dialect #2078 [#2079](https://github.com/apache/datafusion-sqlparser-rs/pull/2079) (watford-ep)
27+
- feat: Add support for SET SESSION AUTHORIZATION #2086 [#2087](https://github.com/apache/datafusion-sqlparser-rs/pull/2087) (watford-ep)
28+
29+
**Fixed bugs:**
30+
31+
- fix: parse error on unnamed arg with default syntax [#2091](https://github.com/apache/datafusion-sqlparser-rs/pull/2091) (r1b)
32+
33+
**Other:**
34+
35+
- Add support for INVISIBLE columns in MySQL [#2033](https://github.com/apache/datafusion-sqlparser-rs/pull/2033) (altmannmarcelo)
36+
- Link to actual change logs in CHANGELOG.md [#2040](https://github.com/apache/datafusion-sqlparser-rs/pull/2040) (lovasoa)
37+
- Snowflake: ALTER USER and KeyValueOptions Refactoring [#2035](https://github.com/apache/datafusion-sqlparser-rs/pull/2035) (yoavcloud)
38+
- Correctly tokenize nested comments in Databricks, ClickHouse, and ANSI [#2044](https://github.com/apache/datafusion-sqlparser-rs/pull/2044) (jmhain)
39+
- MySQL: `CREATE INDEX`: allow `USING` clause before `ON` [#2029](https://github.com/apache/datafusion-sqlparser-rs/pull/2029) (MohamedAbdeen21)
40+
- [databricks] update dialect to support grouping by with modifier [#2047](https://github.com/apache/datafusion-sqlparser-rs/pull/2047) (n-young)
41+
- Moved constraint variant outside of `TableConstraint` enum [#2054](https://github.com/apache/datafusion-sqlparser-rs/pull/2054) (LucaCappelletti94)
42+
- Add support for procedure parameter default values [#2041](https://github.com/apache/datafusion-sqlparser-rs/pull/2041) (aharpervc)
43+
- Support updating PRs using github UI [#2052](https://github.com/apache/datafusion-sqlparser-rs/pull/2052) (blaginin)
44+
- Increase version of sqlparser_derive from 0.3.0 to 0.4.0 [#2060](https://github.com/apache/datafusion-sqlparser-rs/pull/2060) (jjbayer)
45+
- Moving several struct variants out of `Statement` enum to allow for trait impls for specific sub-variants [#2057](https://github.com/apache/datafusion-sqlparser-rs/pull/2057) (LucaCappelletti94)
46+
- Added support for SQLite triggers [#2037](https://github.com/apache/datafusion-sqlparser-rs/pull/2037) (LucaCappelletti94)
47+
- Added support for MATCH syntax and unified column option ForeignKey [#2062](https://github.com/apache/datafusion-sqlparser-rs/pull/2062) (LucaCappelletti94)
48+
- chore: add stack overflow warning for Visitor and VisitorMut [#2068](https://github.com/apache/datafusion-sqlparser-rs/pull/2068) (niebayes)
49+
- Reused `CheckConstraint` in `ColumnOption` [#2063](https://github.com/apache/datafusion-sqlparser-rs/pull/2063) (LucaCappelletti94)
50+
- Refactored `ColumnOption::Unique` to reuse `UniqueConstraint` and `PrimaryKeyConstraint` [#2064](https://github.com/apache/datafusion-sqlparser-rs/pull/2064) (LucaCappelletti94)
51+
- Redshift: more copy options [#2072](https://github.com/apache/datafusion-sqlparser-rs/pull/2072) (yoavcloud)
52+
- SQLite: make period optional for CREATE TRIGGER [#2071](https://github.com/apache/datafusion-sqlparser-rs/pull/2071) (takluyver)
53+
- Added TIMESTAMP_NTZ type support with precision to Snowflake dialect [#2080](https://github.com/apache/datafusion-sqlparser-rs/pull/2080) (romanoff)
54+
- Make `BitwiseNot` ("~") available for all dialects, not just PostgreSQL [#2081](https://github.com/apache/datafusion-sqlparser-rs/pull/2081) (alexander-beedie)
55+
- Add snowflake dynamic table parsing [#2083](https://github.com/apache/datafusion-sqlparser-rs/pull/2083) (romanoff)
56+
- Add support for `INSERT INTO VALUE` [#2085](https://github.com/apache/datafusion-sqlparser-rs/pull/2085) (etgarperets)
57+
- Complete PostgreSQL `CREATE TYPE` Support [#2094](https://github.com/apache/datafusion-sqlparser-rs/pull/2094) (LucaCappelletti94)
58+
- Include DML keyword in statement span [#2090](https://github.com/apache/datafusion-sqlparser-rs/pull/2090) (xitep)
59+
- Add PostgreSQL Operator DDL Support [#2096](https://github.com/apache/datafusion-sqlparser-rs/pull/2096) (LucaCappelletti94)
60+
- impl `Spanned` for MERGE statements [#2100](https://github.com/apache/datafusion-sqlparser-rs/pull/2100) (xitep)
61+
- Preserve optional `AS` keyword in aliases [#2103](https://github.com/apache/datafusion-sqlparser-rs/pull/2103) (xitep)
62+
- Added support for `DROP OPERATOR` syntax [#2102](https://github.com/apache/datafusion-sqlparser-rs/pull/2102) (LucaCappelletti94)
63+
- Only set `hive_formats` on `CreateTable` if formats are present [#2105](https://github.com/apache/datafusion-sqlparser-rs/pull/2105) (mvzink)
64+
- Support PostgreSQL C Functions with Multiple AS Parameters [#2095](https://github.com/apache/datafusion-sqlparser-rs/pull/2095) (LucaCappelletti94)
65+
- Added support for `DROP OPERATOR FAMILY` [#2106](https://github.com/apache/datafusion-sqlparser-rs/pull/2106) (LucaCappelletti94)
66+
- Update criterion requirement from 0.7 to 0.8 in /sqlparser_bench [#2111](https://github.com/apache/datafusion-sqlparser-rs/pull/2111) (dependabot[bot])
67+
- Added support for `DROP OPERATOR CLASS` syntax [#2109](https://github.com/apache/datafusion-sqlparser-rs/pull/2109) (LucaCappelletti94)
68+
- Introduce Oracle dialect [#2113](https://github.com/apache/datafusion-sqlparser-rs/pull/2113) (xitep)
69+
70+
## Credits
71+
72+
Thank you to everyone who contributed to this release. Here is a breakdown of commits (PRs merged) per contributor.
73+
74+
```
75+
12 Luca Cappelletti
76+
4 xitep
77+
2 Andriy Romanov
78+
2 Christopher Watford
79+
2 Yoav Cohen
80+
1 Alexander Beedie
81+
1 Andrew Harper
82+
1 Dmitrii Blaginin
83+
1 Joey Hain
84+
1 Joris Bayer
85+
1 Marcelo Altmann
86+
1 Michael Victor Zink
87+
1 Mohamed Abdeen
88+
1 Ophir LOJKINE
89+
1 Thomas Kluyver
90+
1 dependabot[bot]
91+
1 etgarperets
92+
1 nick young
93+
1 niebayes
94+
1 r1b
95+
```
96+
97+
Thank you also to everyone who contributed in other ways such as filing issues, reviewing PRs, and providing feedback on this release.
98+

dev/release/verify-release-candidate.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,15 @@ test_source_distribution() {
124124
cargo build
125125
cargo test --all-features
126126

127-
if ( find -iname 'Cargo.toml' | xargs grep SNAPSHOT ); then
127+
if ( find . -iname 'Cargo.toml' | xargs grep SNAPSHOT ); then
128128
echo "Cargo.toml version should not contain SNAPSHOT for releases"
129129
exit 1
130130
fi
131131

132+
# Can't test using dry-run because sqlparser depends on sqlparser_derive
133+
# see https://github.com/crate-ci/cargo-release/issues/691#issuecomment-2059866021
132134
# Check that publish works
133-
cargo publish --dry-run
135+
# cargo publish --dry-run
134136
}
135137

136138
TEST_SUCCESS=no

examples/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ $ cargo run --example cli - [--dialectname]
5858
"--clickhouse" => Box::new(ClickHouseDialect {}),
5959
"--duckdb" => Box::new(DuckDbDialect {}),
6060
"--sqlite" => Box::new(SQLiteDialect {}),
61+
"--oracle" => Box::new(OracleDialect {}),
6162
"--generic" | "" => Box::new(GenericDialect {}),
6263
s => panic!("Unexpected parameter: {s}"),
6364
};

src/ast/ddl.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2900,7 +2900,9 @@ impl fmt::Display for CreateTable {
29002900
if let Some(file_format) = self.file_format {
29012901
write!(f, " STORED AS {file_format}")?;
29022902
}
2903-
write!(f, " LOCATION '{}'", self.location.as_ref().unwrap())?;
2903+
if let Some(location) = &self.location {
2904+
write!(f, " LOCATION '{location}'")?;
2905+
}
29042906
}
29052907

29062908
match &self.table_options {

src/dialect/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ mod generic;
2424
mod hive;
2525
mod mssql;
2626
mod mysql;
27+
mod oracle;
2728
mod postgresql;
2829
mod redshift;
2930
mod snowflake;
@@ -45,6 +46,7 @@ pub use self::generic::GenericDialect;
4546
pub use self::hive::HiveDialect;
4647
pub use self::mssql::MsSqlDialect;
4748
pub use self::mysql::MySqlDialect;
49+
pub use self::oracle::OracleDialect;
4850
pub use self::postgresql::PostgreSqlDialect;
4951
pub use self::redshift::RedshiftSqlDialect;
5052
pub use self::snowflake::SnowflakeDialect;
@@ -1260,6 +1262,7 @@ pub fn dialect_from_str(dialect_name: impl AsRef<str>) -> Option<Box<dyn Dialect
12601262
"ansi" => Some(Box::new(AnsiDialect {})),
12611263
"duckdb" => Some(Box::new(DuckDbDialect {})),
12621264
"databricks" => Some(Box::new(DatabricksDialect {})),
1265+
"oracle" => Some(Box::new(OracleDialect {})),
12631266
_ => None,
12641267
}
12651268
}

src/dialect/oracle.rs

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
use super::Dialect;
19+
20+
/// A [`Dialect`] for [Oracle Databases](https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/index.html)
21+
#[derive(Debug)]
22+
pub struct OracleDialect;
23+
24+
impl Dialect for OracleDialect {
25+
// ~ appears not to be called anywhere
26+
fn identifier_quote_style(&self, _identifier: &str) -> Option<char> {
27+
Some('"')
28+
}
29+
30+
fn is_delimited_identifier_start(&self, ch: char) -> bool {
31+
ch == '"'
32+
}
33+
34+
fn is_identifier_start(&self, ch: char) -> bool {
35+
ch.is_alphabetic()
36+
}
37+
38+
fn is_identifier_part(&self, ch: char) -> bool {
39+
ch.is_alphanumeric() || ch == '_' || ch == '$' || ch == '#' || ch == '@'
40+
}
41+
42+
fn supports_outer_join_operator(&self) -> bool {
43+
true
44+
}
45+
46+
fn supports_connect_by(&self) -> bool {
47+
true
48+
}
49+
50+
fn supports_execute_immediate(&self) -> bool {
51+
true
52+
}
53+
54+
fn supports_match_recognize(&self) -> bool {
55+
true
56+
}
57+
58+
fn supports_window_function_null_treatment_arg(&self) -> bool {
59+
true
60+
}
61+
62+
fn supports_boolean_literals(&self) -> bool {
63+
false
64+
}
65+
66+
fn supports_comment_on(&self) -> bool {
67+
true
68+
}
69+
70+
fn supports_create_table_select(&self) -> bool {
71+
true
72+
}
73+
74+
fn supports_set_stmt_without_operator(&self) -> bool {
75+
true
76+
}
77+
78+
fn supports_group_by_expr(&self) -> bool {
79+
true
80+
}
81+
}

src/keywords.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ define_keywords!(
229229
COMMITTED,
230230
COMMUTATOR,
231231
COMPATIBLE,
232+
COMPRESS,
232233
COMPRESSION,
233234
COMPUPDATE,
234235
COMPUTE,
@@ -473,6 +474,7 @@ define_keywords!(
473474
IAM_ROLE,
474475
ICEBERG,
475476
ID,
477+
IDENTIFIED,
476478
IDENTITY,
477479
IDENTITY_INSERT,
478480
IF,
@@ -576,6 +578,7 @@ define_keywords!(
576578
LOG,
577579
LOGIN,
578580
LOGS,
581+
LONG,
579582
LONGBLOB,
580583
LONGTEXT,
581584
LOWCARDINALITY,
@@ -661,6 +664,7 @@ define_keywords!(
661664
NFKD,
662665
NO,
663666
NOBYPASSRLS,
667+
NOCOMPRESS,
664668
NOCREATEDB,
665669
NOCREATEROLE,
666670
NOINHERIT,
@@ -684,6 +688,7 @@ define_keywords!(
684688
NULLABLE,
685689
NULLIF,
686690
NULLS,
691+
NUMBER,
687692
NUMERIC,
688693
NVARCHAR,
689694
OBJECT,
@@ -750,6 +755,7 @@ define_keywords!(
750755
PAST,
751756
PATH,
752757
PATTERN,
758+
PCTFREE,
753759
PER,
754760
PERCENT,
755761
PERCENTILE_CONT,
@@ -922,6 +928,7 @@ define_keywords!(
922928
SIGNED,
923929
SIMILAR,
924930
SIMPLE,
931+
SIZE,
925932
SKIP,
926933
SLOW,
927934
SMALLINT,
@@ -983,6 +990,7 @@ define_keywords!(
983990
SWAP,
984991
SYMMETRIC,
985992
SYNC,
993+
SYNONYM,
986994
SYSTEM,
987995
SYSTEM_TIME,
988996
SYSTEM_USER,
@@ -1094,6 +1102,7 @@ define_keywords!(
10941102
VARBINARY,
10951103
VARBIT,
10961104
VARCHAR,
1105+
VARCHAR2,
10971106
VARIABLE,
10981107
VARIABLES,
10991108
VARYING,

src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12400,7 +12400,7 @@ impl<'a> Parser<'a> {
1240012400
let (tables, with_from_keyword) = if !self.parse_keyword(Keyword::FROM) {
1240112401
// `FROM` keyword is optional in BigQuery SQL.
1240212402
// https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#delete_statement
12403-
if dialect_of!(self is BigQueryDialect | GenericDialect) {
12403+
if dialect_of!(self is BigQueryDialect | OracleDialect | GenericDialect) {
1240412404
(vec![], false)
1240512405
} else {
1240612406
let tables = self.parse_comma_separated(|p| p.parse_object_name(false))?;

src/test_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ pub fn all_dialects() -> TestedDialects {
291291
Box::new(DuckDbDialect {}),
292292
Box::new(DatabricksDialect {}),
293293
Box::new(ClickHouseDialect {}),
294+
Box::new(OracleDialect {}),
294295
])
295296
}
296297

0 commit comments

Comments
 (0)