Skip to content

[chore] Sync upstream #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Jun 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d090ad4
Snowflake COPY INTO target columns, select items and optional alias (…
yoavcloud Apr 11, 2025
bbc80d7
Fix tokenization of qualified identifiers with numeric prefix. (#1803)
romanb Apr 11, 2025
896c088
Add support for `INHERITS` option in `CREATE TABLE` statement (#1806)
LucaCappelletti94 Apr 12, 2025
6566c47
Add `DROP TRIGGER` support for SQL Server (#1813)
aharpervc Apr 15, 2025
514d2ec
Snowflake: support nested join without parentheses (#1799)
barsela1 Apr 15, 2025
3ad13af
Add support for parenthesized subquery as `IN` predicate (#1793)
adamchainz Apr 15, 2025
81d8909
Fix `STRAIGHT_JOIN` constraint when table alias is absent (#1812)
killertux Apr 15, 2025
4a48729
Add support for `PRINT` statement for SQL Server (#1811)
aharpervc Apr 18, 2025
3ec80e1
enable `supports_filter_during_aggregation` for Generic dialect (#1815)
goldmedal Apr 19, 2025
945f8e0
Add support for `XMLTABLE` (#1817)
lovasoa Apr 23, 2025
2eb1e7b
Add `CREATE FUNCTION` support for SQL Server (#1808)
aharpervc Apr 23, 2025
87d1907
Add `OR ALTER` support for `CREATE VIEW` (#1818)
aharpervc Apr 23, 2025
7703fd0
Add `DECLARE ... CURSOR FOR` support for SQL Server (#1821)
aharpervc Apr 24, 2025
4e392f5
Handle missing login in changelog generate script (#1823)
iffyio Apr 28, 2025
2b5bdce
Snowflake: Add support for `CONNECT_BY_ROOT` (#1780)
tomershaniii Apr 29, 2025
c0921dc
Prepare for 0.56.0 release: Version and CHANGELOG (#1822)
iffyio Apr 29, 2025
a5b9821
Update `56.0.0` Changelog with latest commits (#1832)
alamb Apr 29, 2025
e5d2215
Support some of pipe operators (#1759)
simonvandel May 2, 2025
483394c
Added support for `DROP DOMAIN` (#1828)
LucaCappelletti94 May 2, 2025
a464f8e
Improve support for cursors for SQL Server (#1831)
aharpervc May 2, 2025
728645f
Add all missing table options to be handled in any order (#1747)
benrsatori May 2, 2025
a497358
Add `CREATE TRIGGER` support for SQL Server (#1810)
aharpervc May 3, 2025
ac1c339
Added support for `CREATE DOMAIN` (#1830)
LucaCappelletti94 May 4, 2025
6cd237e
Allow stored procedures to be defined without `BEGIN`/`END` (#1834)
aharpervc May 8, 2025
2182f7e
Add support for the MATCH and REGEXP binary operators (#1840)
lovasoa May 8, 2025
052ad4a
Fix: parsing ident starting with underscore in certain dialects (#1835)
MohamedAbdeen21 May 10, 2025
6120bb5
implement pretty-printing with `{:#}` (#1847)
lovasoa May 13, 2025
178a351
Fix big performance issue in string serialization (#1848)
lovasoa May 13, 2025
74a95fd
Add support for `DENY` statements (#1836)
aharpervc May 14, 2025
c6e897d
Postgresql: Add `REPLICA IDENTITY` operation for `ALTER TABLE` (#1844)
MohamedAbdeen21 May 14, 2025
3c59950
Add support for INCLUDE/EXCLUDE NULLS for UNPIVOT (#1849)
Vedin May 15, 2025
ae587dc
pretty print improvements (#1851)
lovasoa May 15, 2025
e7bf186
fix new rust 1.87 cargo clippy warnings (#1856)
lovasoa May 19, 2025
525ed81
Update criterion requirement from 0.5 to 0.6 in /sqlparser_bench (#1857)
dependabot[bot] May 20, 2025
a496f78
pretty-print CREATE TABLE statements (#1854)
lovasoa May 20, 2025
3f4d5f9
pretty-print CREATE VIEW statements (#1855)
lovasoa May 21, 2025
05d7ffb
Handle optional datatypes properly in `CREATE FUNCTION` statements (#…
LucaCappelletti94 May 21, 2025
bf2b72f
Mysql: Add `SRID` column option (#1852)
MohamedAbdeen21 May 23, 2025
3017265
Add support for table valued functions for SQL Server (#1839)
aharpervc May 23, 2025
9159d08
Keep the COLUMN keyword only if it exists when dropping the column (#…
git-hulk May 28, 2025
eacf00d
Add support for parameter default values in SQL Server (#1866)
aharpervc May 29, 2025
a8bde39
Add support for `TABLESAMPLE` pipe operator (#1860)
hendrikmakait May 30, 2025
80d47ee
Adds support for mysql's drop index (#1864)
dmzmk May 30, 2025
394a534
Fix: GROUPING SETS accept values without parenthesis (#1867)
Vedin Jun 2, 2025
5327f0c
Add ICEBERG keyword support to ALTER TABLE statement (#1869)
osipovartem Jun 4, 2025
de2cc7b
MySQL: Support `index_name` in FK constraints (#1871)
MohamedAbdeen21 Jun 6, 2025
4cf5e57
Postgres: Apply `ONLY` keyword per table in TRUNCATE stmt (#1872)
MohamedAbdeen21 Jun 6, 2025
e2b1ae3
feat: Hive: support `SORT BY` direction (#1873)
chenkovsky Jun 6, 2025
ff29dd2
Fix `CASE` expression spans (#1874)
eliaperantoni Jun 6, 2025
84c3a1b
MySQL: `[[NOT] ENFORCED]` in CHECK constraint (#1870)
MohamedAbdeen21 Jun 7, 2025
40d12b9
Add support for `CREATE SCHEMA WITH ( <properties> )` (#1877)
utay Jun 10, 2025
559b7e3
Add support for `ALTER TABLE DROP INDEX` (#1865)
vimko Jun 10, 2025
9fc9009
chore: Replace archived actions-rs/install action (#1876)
assignUser Jun 10, 2025
c2e83d4
Allow `IF NOT EXISTS` after table name for Snowflake (#1881)
bombsimon Jun 11, 2025
703ba2c
Support `DISTINCT AS { STRUCT | VALUE }` for BigQuery (#1880)
bombsimon Jun 11, 2025
83bb534
Merge branch 'main' of ssh://github.com/apache/datafusion-sqlparser-r…
deifactor Jun 13, 2025
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
10 changes: 5 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ name: Rust

on: [push, pull_request]

permissions:
contents: read

jobs:

codestyle:
Expand Down Expand Up @@ -85,11 +88,8 @@ jobs:
uses: ./.github/actions/setup-builder
with:
rust-version: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
- name: Install Tarpaulin
uses: actions-rs/install@v0.1
with:
crate: cargo-tarpaulin
version: 0.14.2
use-tool-cache: true
run: cargo install cargo-tarpaulin
- name: Test
run: cargo test --all-features
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ technically be breaking and thus will result in a `0.(N+1)` version.


- Unreleased: Check https://github.com/sqlparser-rs/sqlparser-rs/commits/main for undocumented changes.
- `0.56.0`: [changelog/0.56.0.md](changelog/0.56.0.md)
- `0.55.0`: [changelog/0.55.0.md](changelog/0.55.0.md)
- `0.54.0`: [changelog/0.54.0.md](changelog/0.54.0.md)
- `0.53.0`: [changelog/0.53.0.md](changelog/0.53.0.md)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[package]
name = "sqlparser"
description = "Extensible SQL Lexer and Parser with support for ANSI SQL:2011"
version = "0.55.0"
version = "0.56.0"
authors = ["Apache DataFusion <dev@datafusion.apache.org>"]
homepage = "https://github.com/apache/datafusion-sqlparser-rs"
documentation = "https://docs.rs/sqlparser/"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ keywords, the following should hold true for all SQL:

```rust
// Parse SQL
let sql = "SELECT 'hello'";
let ast = Parser::parse_sql(&GenericDialect, sql).unwrap();

// The original SQL text can be generated from the AST
assert_eq!(ast[0].to_string(), sql);

// The SQL can also be pretty-printed with newlines and indentation
assert_eq!(format!("{:#}", ast[0]), "SELECT\n 'hello'");
```

There are still some cases in this crate where different SQL with seemingly
Expand Down
102 changes: 102 additions & 0 deletions changelog/0.56.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# sqlparser-rs 0.56.0 Changelog

This release consists of 48 commits from 19 contributors. See credits at the end of this changelog for more information.

**Other:**

- Ignore escaped LIKE wildcards in MySQL [#1735](https://github.com/apache/datafusion-sqlparser-rs/pull/1735) (mvzink)
- Parse SET NAMES syntax in Postgres [#1752](https://github.com/apache/datafusion-sqlparser-rs/pull/1752) (mvzink)
- re-add support for nested comments in mssql [#1754](https://github.com/apache/datafusion-sqlparser-rs/pull/1754) (lovasoa)
- Extend support for INDEX parsing [#1707](https://github.com/apache/datafusion-sqlparser-rs/pull/1707) (LucaCappelletti94)
- Parse MySQL `ALTER TABLE DROP FOREIGN KEY` syntax [#1762](https://github.com/apache/datafusion-sqlparser-rs/pull/1762) (mvzink)
- add support for `with` clauses (CTEs) in `delete` statements [#1764](https://github.com/apache/datafusion-sqlparser-rs/pull/1764) (lovasoa)
- SET with a list of comma separated assignments [#1757](https://github.com/apache/datafusion-sqlparser-rs/pull/1757) (MohamedAbdeen21)
- Preserve MySQL-style `LIMIT <offset>, <limit>` syntax [#1765](https://github.com/apache/datafusion-sqlparser-rs/pull/1765) (mvzink)
- Add support for `DROP MATERIALIZED VIEW` [#1743](https://github.com/apache/datafusion-sqlparser-rs/pull/1743) (iffyio)
- Add `CASE` and `IF` statement support [#1741](https://github.com/apache/datafusion-sqlparser-rs/pull/1741) (iffyio)
- BigQuery: Add support for `CREATE SCHEMA` options [#1742](https://github.com/apache/datafusion-sqlparser-rs/pull/1742) (iffyio)
- Snowflake: Support dollar quoted comments [#1755](https://github.com/apache/datafusion-sqlparser-rs/pull/1755)
- Add LOCK operation for ALTER TABLE [#1768](https://github.com/apache/datafusion-sqlparser-rs/pull/1768) (MohamedAbdeen21)
- Add support for `RAISE` statement [#1766](https://github.com/apache/datafusion-sqlparser-rs/pull/1766) (iffyio)
- Add GLOBAL context/modifier to SET statements [#1767](https://github.com/apache/datafusion-sqlparser-rs/pull/1767) (MohamedAbdeen21)
- Parse `SUBSTR` as alias for `SUBSTRING` [#1769](https://github.com/apache/datafusion-sqlparser-rs/pull/1769) (mvzink)
- SET statements: scope modifier for multiple assignments [#1772](https://github.com/apache/datafusion-sqlparser-rs/pull/1772) (MohamedAbdeen21)
- Support qualified column names in `MATCH AGAINST` clause [#1774](https://github.com/apache/datafusion-sqlparser-rs/pull/1774) (tomershaniii)
- Mysql: Add support for := operator [#1779](https://github.com/apache/datafusion-sqlparser-rs/pull/1779) (barsela1)
- Add cipherstash-proxy to list of users in README.md [#1782](https://github.com/apache/datafusion-sqlparser-rs/pull/1782) (coderdan)
- Fix typos [#1785](https://github.com/apache/datafusion-sqlparser-rs/pull/1785) (jayvdb)
- Add support for Databricks TIMESTAMP_NTZ. [#1781](https://github.com/apache/datafusion-sqlparser-rs/pull/1781) (romanb)
- Enable double-dot-notation for mssql. [#1787](https://github.com/apache/datafusion-sqlparser-rs/pull/1787) (romanb)
- Fix: Snowflake ALTER SESSION cannot be followed by other statements. [#1786](https://github.com/apache/datafusion-sqlparser-rs/pull/1786) (romanb)
- Add GreptimeDB to the "Users" in README [#1788](https://github.com/apache/datafusion-sqlparser-rs/pull/1788) (MichaelScofield)
- Extend snowflake grant options support [#1794](https://github.com/apache/datafusion-sqlparser-rs/pull/1794) (yoavcloud)
- Fix clippy lint on rust 1.86 [#1796](https://github.com/apache/datafusion-sqlparser-rs/pull/1796) (iffyio)
- Allow single quotes in EXTRACT() for Redshift. [#1795](https://github.com/apache/datafusion-sqlparser-rs/pull/1795) (romanb)
- MSSQL: Add support for functionality `MERGE` output clause [#1790](https://github.com/apache/datafusion-sqlparser-rs/pull/1790) (dilovancelik)
- Support additional DuckDB integer types such as HUGEINT, UHUGEINT, etc [#1797](https://github.com/apache/datafusion-sqlparser-rs/pull/1797) (alexander-beedie)
- Add support for MSSQL IF/ELSE statements. [#1791](https://github.com/apache/datafusion-sqlparser-rs/pull/1791) (romanb)
- Allow literal backslash escapes for string literals in Redshift dialect. [#1801](https://github.com/apache/datafusion-sqlparser-rs/pull/1801) (romanb)
- Add support for MySQL's STRAIGHT_JOIN join operator. [#1802](https://github.com/apache/datafusion-sqlparser-rs/pull/1802) (romanb)
- Snowflake COPY INTO target columns, select items and optional alias [#1805](https://github.com/apache/datafusion-sqlparser-rs/pull/1805) (yoavcloud)
- Fix tokenization of qualified identifiers with numeric prefix. [#1803](https://github.com/apache/datafusion-sqlparser-rs/pull/1803) (romanb)
- Add support for `INHERITS` option in `CREATE TABLE` statement [#1806](https://github.com/apache/datafusion-sqlparser-rs/pull/1806) (LucaCappelletti94)
- Add `DROP TRIGGER` support for SQL Server [#1813](https://github.com/apache/datafusion-sqlparser-rs/pull/1813) (aharpervc)
- Snowflake: support nested join without parentheses [#1799](https://github.com/apache/datafusion-sqlparser-rs/pull/1799) (barsela1)
- Add support for parenthesized subquery as `IN` predicate [#1793](https://github.com/apache/datafusion-sqlparser-rs/pull/1793) (adamchainz)
- Fix `STRAIGHT_JOIN` constraint when table alias is absent [#1812](https://github.com/apache/datafusion-sqlparser-rs/pull/1812) (killertux)
- Add support for `PRINT` statement for SQL Server [#1811](https://github.com/apache/datafusion-sqlparser-rs/pull/1811) (aharpervc)
- enable `supports_filter_during_aggregation` for Generic dialect [#1815](https://github.com/apache/datafusion-sqlparser-rs/pull/1815) (goldmedal)
- Add support for `XMLTABLE` [#1817](https://github.com/apache/datafusion-sqlparser-rs/pull/1817) (lovasoa)
- Add `CREATE FUNCTION` support for SQL Server [#1808](https://github.com/apache/datafusion-sqlparser-rs/pull/1808) (aharpervc)
- Add `OR ALTER` support for `CREATE VIEW` [#1818](https://github.com/apache/datafusion-sqlparser-rs/pull/1818) (aharpervc)
- Add `DECLARE ... CURSOR FOR` support for SQL Server [#1821](https://github.com/apache/datafusion-sqlparser-rs/pull/1821) (aharpervc)
- Handle missing login in changelog generate script [#1823](https://github.com/apache/datafusion-sqlparser-rs/pull/1823) (iffyio)
- Snowflake: Add support for `CONNECT_BY_ROOT` [#1780](https://github.com/apache/datafusion-sqlparser-rs/pull/1780) (tomershaniii)

## Credits

Thank you to everyone who contributed to this release. Here is a breakdown of commits (PRs merged) per contributor.

```
8 Roman Borschel
6 Ifeanyi Ubah
5 Andrew Harper
5 Michael Victor Zink
4 Mohamed Abdeen
3 Ophir LOJKINE
2 Luca Cappelletti
2 Yoav Cohen
2 bar sela
2 tomershaniii
1 Adam Johnson
1 Aleksei Piianin
1 Alexander Beedie
1 Bruno Clemente
1 Dan Draper
1 DilovanCelik
1 Jax Liu
1 John Vandenberg
1 LFC
```

Thank you also to everyone who contributed in other ways such as filing issues, reviewing PRs, and providing feedback on this release.

5 changes: 3 additions & 2 deletions dev/release/generate-changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def print_pulls(repo_name, title, pulls):
print()
for (pull, commit) in pulls:
url = "https://github.com/{}/pull/{}".format(repo_name, pull.number)
print("- {} [#{}]({}) ({})".format(pull.title, pull.number, url, commit.author.login))
author = f"({commit.author.login})" if commit.author else ''
print("- {} [#{}]({}) {}".format(pull.title, pull.number, url, author))
print()


Expand Down Expand Up @@ -161,4 +162,4 @@ def cli(args=None):
generate_changelog(repo, project, args.tag1, args.tag2, args.version)

if __name__ == "__main__":
cli()
cli()
2 changes: 1 addition & 1 deletion sqlparser_bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ edition = "2018"
sqlparser = { path = "../" }

[dev-dependencies]
criterion = "0.5"
criterion = "0.6"

[[bench]]
name = "sqlparser_bench"
Expand Down
2 changes: 1 addition & 1 deletion sqlparser_bench/benches/sqlparser_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn basic_queries(c: &mut Criterion) {
};

group.bench_function("parse_large_statement", |b| {
b.iter(|| Parser::parse_sql(&dialect, criterion::black_box(large_statement.as_str())));
b.iter(|| Parser::parse_sql(&dialect, std::hint::black_box(large_statement.as_str())));
});

let large_statement = Parser::parse_sql(&dialect, large_statement.as_str())
Expand Down
24 changes: 22 additions & 2 deletions src/ast/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@ pub enum DataType {
/// Table type in [PostgreSQL], e.g. CREATE FUNCTION RETURNS TABLE(...).
///
/// [PostgreSQL]: https://www.postgresql.org/docs/15/sql-createfunction.html
Table(Vec<ColumnDef>),
/// [MsSQL]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql?view=sql-server-ver16#c-create-a-multi-statement-table-valued-function
Table(Option<Vec<ColumnDef>>),
/// Table type with a name, e.g. CREATE FUNCTION RETURNS @result TABLE(...).
///
/// [MsSQl]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql?view=sql-server-ver16#table
NamedTable {
/// Table name.
name: ObjectName,
/// Table columns.
columns: Vec<ColumnDef>,
},
/// Fixed-length character type, e.g. CHARACTER(10).
Character(Option<CharacterLength>),
/// Fixed-length char type, e.g. CHAR(10).
Expand Down Expand Up @@ -716,7 +726,17 @@ impl fmt::Display for DataType {
DataType::Unspecified => Ok(()),
DataType::Trigger => write!(f, "TRIGGER"),
DataType::AnyType => write!(f, "ANY TYPE"),
DataType::Table(fields) => write!(f, "TABLE({})", display_comma_separated(fields)),
DataType::Table(fields) => match fields {
Some(fields) => {
write!(f, "TABLE({})", display_comma_separated(fields))
}
None => {
write!(f, "TABLE")
}
},
DataType::NamedTable { name, columns } => {
write!(f, "{} TABLE ({})", name, display_comma_separated(columns))
}
DataType::GeometricType(kind) => write!(f, "{}", kind),
}
}
Expand Down
Loading
Loading