All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project aims to adhere to Semantic Versioning.
Given that the parser produces a typed AST, any changes to the AST will technically be breaking and thus will result in a 0.(N+1) version. We document changes that break via addition as "Added".
Check https://github.com/sqlparser-rs/sqlparser-rs/commits/main for undocumented changes.
- Add ALTER TABLE CHANGE COLUMN, extend the UPDATE statement with ON clause (#375) - Thanks @0xA537FD!
- Add support for GROUPIING SETS, ROLLUP and CUBE - Thanks @Jimexist!
- Add basic support for GRANT and REVOKE (#365) - Thanks @blx!
- Use Rust 2021 edition (#368) - Thanks @Jimexist!
- Fix clippy errors (#367, #374) - Thanks @Jimexist!
- Add support for [NOT] IS DISTINCT FROM (#306) - @Dandandan
- Move the keywords module - Thanks @koushiro!
- Support minimum display width for integer data types (#337) Thanks @vasilev-alex!
- Add logical XOR operator (#357) - Thanks @xzmrdltl!
- Support DESCRIBE table_name (#340) - Thanks @ovr!
- Support SHOW CREATE TABLE|EVENT|FUNCTION (#338) - Thanks @ovr!
- Add referential actions to TableConstraint foreign key (#306) - Thanks @joshwd36!
- Enable map access for numbers, multiple nesting levels (#356) - Thanks @Igosuki!
- Rename Token::Mult to Token::Mul (#353) - Thanks @koushiro!
- Use derive(Default) for HiveFormat (#348) - Thanks @koushiro!
- Improve tokenizer error (#347) - Thanks @koushiro!
- Eliminate redundant string copy in Tokenizer (#343) - Thanks @koushiro!
- Update bigdecimal requirement from 0.2 to 0.3 dependencies (#341)
- Support parsing hexadecimal literals that start with
0x(#324) - Thanks @TheSchemm!
- Support for
no_std(#332) - Thanks @koushiro! - Postgres regular expression operators (
~,~*,!~,!~*) (#328) - Thanks @b41sh! - tinyint (#320) - Thanks @sundy-li
- ILIKE (#300) - Thanks @maxcountryman!
- TRIM syntax (#331, #334) - Thanks ever0de
- Return error instead of panic (#316) - Thanks @BohuTANG!
- Rename
ModulustoModulo(#335) - Thanks @RGRAVITY817! - Update links to reflect repository move to
sqlparser-rsGitHub org (#333) - Thanks @andygrove - Add default value for
WindowFrame(#313) - Thanks @Jimexist!
- Add support for
TRY_CASTsyntax (#299) - Thanks @seddonm1!
- Introduce Hive QL dialect
HiveDialectand 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!
- 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)
- Enable dialect-specific behaviours in the parser (
dialect_of!()) (#254) - thanks @eyalleshem! - Support named arguments in function invocations (
ARG_NAME => val) (#250) - thanks @eyalleshem! - Support
TABLE()functions inFROM(#253) - thanks @eyalleshem! - Support Snowflake's single-line comments starting with '#' or '//' (#264) - thanks @eyalleshem!
- Support PostgreSQL
PREPARE,EXECUTE, andDEALLOCATE(#243) - thanks @silathdiir! - 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) aliassyntax - thanks @eyalleshem! - Support for
EXPLAIN [ANALYZE] VERBOSE- thanks @ovr! - Support
ANALYZE TABLE - DDL:
- Support
OR REPLACEinCREATE VIEW/TABLE(#239) - thanks @Dandandan! - Support specifying
ASC/DESCin index columns (#249) - thanks @mashuai! - Support SQLite
AUTOINCREMENTand MySQLAUTO_INCREMENTcolumn option inCREATE TABLE(#234) - thanks @mashuai! - Support PostgreSQL
IF NOT EXISTSforCREATE SCHEMA(#276) - thanks @alex-dukhno!
- Support
- Fix a typo in
JSONFILEserialization, introduced in 0.3.1 (#237) - Change
CREATE INDEXserialization to not end with a semicolon, introduced in 0.5.1 (#245) - Don't fail parsing
ALTER TABLE ADD COLUMNending with a semicolon, introduced in 0.5.1 (#246) - thanks @mashuai
- Support BigQuery
ASSERTstatement (#226)
- Support SQLite's
CREATE TABLE (...) WITHOUT ROWID(#208) - thanks @mashuai! - Support SQLite's
CREATE VIRTUAL TABLE(#209) - thanks @mashuai!
This release should have been called 0.6, as it introduces multiple incompatible changes to the API. If you don't want to upgrade yet, you can revert to the previous version by changing your Cargo.toml to:
sqlparser = "= 0.5.0"
Parser::parse_sqlnow accepts a&strinstead ofString(#182) - thanks @Dandandan!- Change
Ident(previously a simpleString) to store the parsed (unquoted)valueof the identifier and thequote_styleseparately (#143) - thanks @apparebit! - Support Snowflake's
FROM (table_name)(#155) - thanks @eyalleshem! - Add line and column number to TokenizerError (#194) - thanks @Dandandan!
- Use Token::EOF instead of Option (#195)
- Make the units keyword following
INTERVAL '...'optional (#184) - thanks @maxcountryman! - Generalize
DATE/TIME/TIMESTAMPliterals representation in the AST (TypedString { data_type, value }) and allowDATEand other keywords to be used as identifiers when not followed by a string (#187) - thanks @maxcountryman! - Output DataType capitalized (
fmt::Display) (#202) - thanks @Dandandan!
- Support MSSQL
TOP (<N>) [ PERCENT ] [ WITH TIES ](#150) - thanks @alexkyllo! - Support MySQL
LIMIT row_count OFFSET offset(not followed byROWorROWS) and remember which variant was parsed (#158) - thanks @mjibson! - Support PostgreSQL
CREATE TABLE IF NOT EXISTS table_name(#163) - thanks @alex-dukhno! - Support basic forms of
CREATE INDEXandDROP INDEX(#167) - thanks @mashuai! - Support
ON { UPDATE | DELETE } { RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT }inFOREIGN KEYconstraints (#170) - thanks @c7hm4r! - Support basic forms of
CREATE SCHEMAandDROP SCHEMA(#173) - thanks @alex-dukhno! - Support
NULLS FIRST/LASTinORDER BYexpressions (#176) - thanks @houqp! - Support
LISTAGG()(#174) - thanks @maxcountryman! - Support the string concatentation operator
||(#178) - thanks @Dandandan! - Support bitwise AND (
&), OR (|), XOR (^) (#181) - thanks @Dandandan! - Add serde support to AST structs and enums (#196) - thanks @panarch!
- Support
ALTER TABLE ADD COLUMN,RENAME COLUMN, andRENAME TO(#203) - thanks @mashuai! - Support
ALTER TABLE DROP COLUMN(#148) - thanks @ivanceras! - Support
CREATE TABLE ... AS ...(#206) - thanks @Dandandan!
- Report an error for unterminated string literals (#165)
- Make file format (
STORED AS) case insensitive (#200) and don't allow quoting it (#201) - thanks @Dandandan!
- Replace the
Value::Long(u64)andValue::Double(f64)variants withValue::Number(String)to avoid losing precision when parsing decimal literals (#130) - thanks @benesch! --features bigdecimalcan be enabled to work withValue::Number(BigDecimal)instead, at the cost of an additional dependency.
- Support MySQL
SHOW COLUMNS,SET <variable>=<value>, andSHOW <variable>statements (#135) - thanks @quodlibetor and @benesch!
- Don't fail to parse
START TRANSACTIONfollowed by a semicolon (#139) - thanks @gaffneyk!
This release brings us closer to SQL-92 support, mainly thanks to the improvements contributed back from @MaterializeInc's fork and other work by @benesch.
- Remove "SQL" from type and enum variant names,
SQLType->DataType, remove "sql" prefix from module names (#105, #122) - Rename
ASTNode->Expr(#119) - Improve consistency of binary/unary op nodes (#112):
ASTNode::SQLBinaryExpris nowExpr::BinaryOpandASTNode::SQLUnaryisExpr::UnaryOp;- The
op: SQLOperatorfield is now either aBinaryOperatoror anUnaryOperator.
- Change the representation of JOINs to match the standard (#109):
SQLSelect'srelationandjoinsare replaced withfrom: Vec<TableWithJoins>. Before this changeFROM foo NATURAL JOIN bar, bazwas represented as "foo" as therelationfollowed by two joins (Inner(Natural)andImplicit); now it's twoTableWithJoins(foo NATURAL JOIN barandbaz). - Extract a
SQLFunctionstruct (#89) - Replace
Option<Vec<T>>withVec<T>in the AST structs (#73) - Change
Value::Long()to be unsigned, use u64 consistently (#65)
- Infra:
- Implement
fmt::Displayon AST nodes (#124) - thanks @vemoo! - Implement
Hash(#88) andEq(#123) on all AST nodes - Implement
std::error::ErrorforParserError(#72) - Handle Windows line-breaks (#54)
- Implement
- Expressions:
- Support
INTERVALliterals (#103) - Support
DATE/TIME/TIMESTAMPliterals (#99) - Support
EXTRACT(#96) - Support
X'hex value'literals (#95) - Support
EXISTSsubqueries (#90) - Support nested expressions in
BETWEEN(#80) - Support
COUNT(DISTINCT x)and similar (#77) - Support
CASE operand WHEN expected_value THEN ..and table-valued functions (#59) - Support analytic (window) functions (
OVERclause) (#50)
- Support
- Queries / DML:
- Support nested joins (#100) and derived tables with set operations (#111)
- Support
UPDATEstatements (#97) - Support
INSERT INTO foo SELECT * FROM barandFROM VALUES (...)(#91) - Support
SELECT ALL(#76) - Add
FETCHandOFFSETsupport, andLATERAL(#69) - thanks @thomas-jeepe! - Support
COLLATE, optional column list in CTEs (#64)
- DDL/TCL:
- Support
START/SET/COMMIT/ROLLBACK TRANSACTION(#106) - thanks @SamuelMarks! - Parse column constraints in any order (#93)
- Parse
DECIMALandDECaliases forNUMERICtype (#92) - Support
DROP [TABLE|VIEW](#75) - Support arbitrary
WITHoptions forCREATE [TABLE|VIEW](#74) - Support constraints in
CREATE TABLE(#65)
- Support
- Add basic MSSQL dialect (#61) and some MSSQL-specific features:
CROSS/OUTER APPLY(#120)- MSSQL identifier and alias parsing rules (#66)
WITHhints (#59)
- Report an error for
SELECT * FROM a OUTER JOIN binstead of parsingOUTERas an alias (#118) - Fix the precedence of
NOT LIKE(#82) and unaryNOT(#107) - Do not panic when
NOTis not followed by an expected keyword (#71) successfully instead of returning a parse error - thanks @ivanceras! (#67) - and similar fixes for queries with noFROM(#116) - Fix issues with
ALTER TABLE ADD CONSTRAINTparsing (#65) - Serialize the "not equals" operator as
<>instead of!=(#64) - Remove dependencies on
uuid(#59) andchrono(#61) - Make
SELECTquery withLIMITclause but noWHEREparse - Fix incorrect behavior ofASTNode::SQLQualifiedWildcard::to_string()(returnedfoo*instead offoo.*) - thanks @thomas-jeepe! (#52)
- Extended
SQLStatement::SQLCreateTableto support Hive's EXTERNAL TABLES (CREATE EXTERNAL TABLE .. STORED AS .. LOCATION '..') - thanks @zhzy0077! (#46) - Parse
SELECT DISTINCTtoSQLSelect::distinct(#49)
This release includes major changes to the AST structs to add a number of features, as described in #37 and #43. In particular:
ASTNodevariants that represent statements were extracted fromASTNodeinto a separateSQLStatementenum;Parser::parse_sqlnow returns aVecof parsed statements.ASTNodenow represents an expression (renamed toExprin 0.4.0)
- The query representation (formerly
ASTNode::SQLSelect) became more complicated to support:WITHandUNION/EXCEPT/INTERSECT(viaSQLQuery,Cte, andSQLSetExpr),- aliases and qualified wildcards in
SELECT(viaSQLSelectItem), - and aliases in
FROM/JOIN(viaTableFactor).
- A new
SQLObjectNamestruct is used instead ofStringorASTNode::SQLCompoundIdentifier- for objects like tables, custom types, etc. - Added support for "delimited identifiers" and made keywords context-specific (thus accepting them as valid identifiers in most contexts) - this caused a regression in parsing
SELECT .. FROM .. LIMIT ..(#67), fixed in 0.4.0
Other than the changes listed above, some less intrusive additions include:
- Support
CREATE [MATERIALIZED] VIEWstatement - Support
IN,BETWEEN, unary +/- in epressions - Support
CHARdata type andNUMERICnot followed by(p,s). - Support national string literals (
N'...')
Same as 0.2.2.
- Removed
Value::String,Value::DoubleQuotedString, andToken::String, making'...'parse as a string literal (Value::SingleQuotedString), and"..."fail to parse until version 0.3.0 (#36)
We don't have a changelog for the changes made in 2018, but thanks to @crw5996, @cswinter, @fredrikroos, @ivanceras, @nickolay, @virattara for their contributions in the early stages of the project!
Initial release