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".
Nothing here yet! Check https://github.com/andygrove/sqlparser-rs/commits/master for undocumented changes.
- Now supports parsing date and time types
- ast::Value::Interval changed its representation to include an inner
IntervalValue that includes a
ParsedDateTime
and some useful methods. - ast::Value::Date changed its representation to include an inner
ParsedDate
- ast::Value::Interval changed its representation to include an inner
IntervalValue that includes a
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::SQLBinaryExpr
is nowExpr::BinaryOp
andASTNode::SQLUnary
isExpr::UnaryOp
;- The
op: SQLOperator
field is now either aBinaryOperator
or anUnaryOperator
.
- Change the representation of JOINs to match the standard (#109):
SQLSelect
'srelation
andjoins
are replaced withfrom: Vec<TableWithJoins>
. Before this changeFROM foo NATURAL JOIN bar, baz
was represented as "foo" as therelation
followed by two joins (Inner(Natural)
andImplicit
); now it's twoTableWithJoins
(foo NATURAL JOIN bar
andbaz
). - Extract a
SQLFunction
struct (#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::Display
on AST nodes (#124) - thanks @vemoo! - Implement
Hash
(#88) andEq
(#123) on all AST nodes - Implement
std::error::Error
forParserError
(#72) - Handle Windows line-breaks (#54)
- Implement
- Expressions:
- Support
INTERVAL
literals (#103) - Support
DATE
/TIME
/TIMESTAMP
literals (#99) - Support
EXTRACT
(#96) - Support
X'hex value'
literals (#95) - Support
EXISTS
subqueries (#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 (
OVER
clause) (#50)
- Support
- Queries / DML:
- Support nested joins (#100) and derived tables with set operations (#111)
- Support
UPDATE
statements (#97) - Support
INSERT INTO foo SELECT * FROM bar
andFROM VALUES (...)
(#91) - Support
SELECT ALL
(#76) - Add
FETCH
andOFFSET
support, 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
DECIMAL
andDEC
aliases forNUMERIC
type (#92) - Support
DROP [TABLE|VIEW]
(#75) - Support arbitrary
WITH
options 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)
WITH
hints (#59)
- Report an error for
SELECT * FROM a OUTER JOIN b
instead of parsingOUTER
as an alias (#118) - Fix the precedence of
NOT LIKE
(#82) and unaryNOT
(#107) - Do not panic when
NOT
is 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 CONSTRAINT
parsing (#65) - Serialize the "not equals" operator as
<>
instead of!=
(#64) - Remove dependencies on
uuid
(#59) andchrono
(#61) - Make
SELECT
query withLIMIT
clause but noWHERE
parse - Fix incorrect behavior ofASTNode::SQLQualifiedWildcard::to_string()
(returnedfoo*
instead offoo.*
) - thanks @thomas-jeepe! (#52)
- Extended
SQLStatement::SQLCreateTable
to support Hive's EXTERNAL TABLES (CREATE EXTERNAL TABLE .. STORED AS .. LOCATION '..'
) - thanks @zhzy0077! (#46) - Parse
SELECT DISTINCT
toSQLSelect::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:
ASTNode
variants that represent statements were extracted fromASTNode
into a separateSQLStatement
enum;Parser::parse_sql
now returns aVec
of parsed statements.ASTNode
now represents an expression (renamed toExpr
in 0.4.0)
- The query representation (formerly
ASTNode::SQLSelect
) became more complicated to support:WITH
andUNION
/EXCEPT
/INTERSECT
(viaSQLQuery
,Cte
, andSQLSetExpr
),- aliases and qualified wildcards in
SELECT
(viaSQLSelectItem
), - and aliases in
FROM
/JOIN
(viaTableFactor
).
- A new
SQLObjectName
struct is used instead ofString
orASTNode::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] VIEW
statement - Support
IN
,BETWEEN
, unary +/- in epressions - Support
CHAR
data type andNUMERIC
not 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