Releases: nene/sql-parser-cst
Releases · nene/sql-parser-cst
0.23.0
Breaking changes
- The
constraint_deferrablenode has been replaced with array ofconstraint_modifiernodes.
Accordingly thedeferrablefield inconstraintnode has been renamed tomodifiers. onConflictfield has been replaced withclausesarray.
The affects:constraint_primary_key,constraint_unique,constraint_check,constraint_not_null.- Various
*Kwfields have been replaced withkindfield that containstable_kindnode:- in
create_table_stmt:temporaryKw,unloggedKw,externalKw,snapshotKw,virtualKw. - in
drop_table_stmt:temporaryKw,externalKw,snapshotKw. - in
into_table_clause:temporaryKw,unloggedKw.
- in
- The
sort_specificationnode has been replaced withindex_specificationnode in places that reference indexes.
This effects:constraint_primary_key,create_index_stmt,upsert_clause.
Bugfixes
- MySQL column
KEYconstraint is now parsed asconstraint_primary_key(instead ofconstraint_index). doKwfield inupsert_clausenow has correct type:Keyword<"DO">(instead ofKeyword<"DOR">).
Improved MySQL/MariaDB support
-
Improved
CREATE TABLEsupport:- Support index name in
FOREIGN KEY - Support
TABLESPACE&STORAGEoptions - Support
UNIONoption - Support
[NOT] ENFORCEDmodifier onCHECK()constraint
- Support index name in
-
Improved
ALTER TABLEsupport:- Support
ALTER COLUMN(SET {VISIBLE | INVISIBLE}) - Support
ADD CONSTRAINT - Support
DROP CONSTRAINT - Support
ALTER CONSTRAINT
- Support
Improved PostgreSQL support
-
Almost complete
CREATE TABLEsupport:- Support
DEFAULT expr - Support
STORAGEconstraint - Support
COMPRESSIONconstraint - Support
GENERATED AS IDENTITY - Support
UNIQUE NULLS [NOT] DISTINCT - Support
SET NULL/DEFAULTwith columns insideREFERENCESaction - Support
GLOBAL|LOCAL TEMP TABLE - Support
UNLOGGED TABLE - Support
NO INHERITconstraint modifier - Support
CREATE TABLE .. INHERITS () - Support
PARTITION BYclause - Support
PARTITION OF - Support
MINVALUE & MAXVALUE FOR VALUES - Support
FOR VALUES WITH ... MODULUS & REMAINDER - Support
ON COMMITclause - Support
TABLESPACEclause - Support
USINGclause - Support
WITHclause - Support
WITHOUT OIDSclause - Support
CREATE TABLE .. OF type - Support
EXCLUDEconstraint - Support
LIKEclause inside columns list - Support index parameter clauses
- Support
WITH OPTIONScolumn definitions - Support
CREATE TABLE AS .. WITH [NO] DATA
- Support
-
Basic
ALTER TABLEsupport:- Support
[ONLY] name [*] - Support
CASCADE|RESTRICT in ALTER TABLE .. DROP COLUMN - Support
ALTER COLUMN .. SET NOT NULL - Support basic
ALTER COLUMN .. SET DATA TYPE - Support
ADD CONSTRAINT - Support
DROP CONSTRAINT - Support
ALTER CONSTRAINT - Support
RENAME CONSTRAINT - Support
VALIDATE CONSTRAINT
- Support
-
Basic
CREATE/DROP INDEXsupport
0.22.1
0.22.0
Breaking changes
- Renamed
TruncateStmt.tablefield totableswhich now containsListExpr - Moved
ReturningClauseandClusterByClausetypes fromAllSelectClausestoAllOtherClauses - Renamed
UpsertClause.columnsfield toconflictTarget - Divided
MergeStmttoMergeStmtandMergeClause(to accommodateWithClauseinsideMergeStmt) - Renamed
MergeActionInsert.valuesfield toclauses
Improved PostgreSQL support
- Full support for
UPDATEstatement- Support
[ONLY] table [*] - Support
SET col = DEFAULT - Support
WHERE CURRENT OFclause
- Support
- Full support for
DELETEstatement- Support
[ONLY] table [*] - Support
USINGclause - Support
WHERE CURRENT OFclause
- Support
- Full support for
TRUNCATEstatement- Support
[ONLY] table [*] - Support multiple tables
- Support
CASCADE/RESTRICT - Support
RESTART/CONTINUE IDENTITY
- Support
- Full support for
MERGEstatement- Support
WITHclause - Support
[ONLY] table [*] - Support
OVERRIDINGclause - Support
INSERT DEFAULT VALUES - Support
DO NOTHINGaction
- Support
- Almost full support for
INSERTstatement- Support
ON CONFLICTclause - Support
ON CONFLICT (expr) - Support
ON CONFLICT ON CONSTRAINT - Support
OVERRIDINGclause
- Support
Bugfixes
- Fixed some serious performance regressions, especially when parsing PostgreSQL (#52)
YEAR_MONTHkeyword is now case-insensitive (like all others)
0.21.2
0.21.1
0.21.0
Breaking changes
- Replace
distinctKw,hintsandasStructOrValueKwfields inselect_clausewithmodifiersfield- Rename
mysql_hinttomysql_modifier - Parse
DISTINCTandALLnot as plain keywords, but as new separate nodes - Parse
AS STRUCT / VALUEasselect_as_struct/select_as_valuenodes.
- Rename
- Rename
hintsfield tomodifiersininsert_clause,update_clause,delete_clause. - Replace plain
ASC/DESCkeyword withsort_direction_*nodes (both inorder_by_clauseandconstraint_primary_key) - Change
tablesample_exprto allow for custom methods, changing type oftablesampleKwfield - Remove single
ROLLUP()inGROUP BYrestriction, changing the type ofcolumnsfield
PostgreSQL support
- Query syntax:
- Support
UPDATE,INSERT,DELETEinsideWITHclause - Support
GROUP BY GROUPING SETS, CUBE(), () - Support
CYCLEclause inWITH - Support
SEARCHclause inWITH - Support
ORDER BY .. USINGoperator - Support column aliases in table aliases
- Support table function with column definitions
- Support
ROWS FROM - Support
LATERALsubqueries and table functions - Support
REPEATABLEclause inTABLESAMPLE - Support
table *andONLY tableinheritance syntax - Support
SELECT DISTINCT ON ()
- Support
- Operators:
- Support
:=syntax for named function arguments - Support
~as both a unary and binary operator - Support
OPERATOR()syntax
- Support
Bugfixes
- Properly support full table names in
TABLEclause/statement - Restrict the type of
exprfield incommon_table_exprnode - Remove
!operator support from SQLite - Fix
~operator precedence in PostgreSQL
Internals
- Switch to Peggy 3
0.20.0
Breaking changes
- Removed
insert_columns_clausenode. Reintroducedcolumnsfield toinsert_clause. This effectively reverts the change done in 0.18.0. - Related to the above, PARTITION selection in MySQL INSERT and DELETE statements is now parsed as
partitioned_table. Thepartition_clausenode has been removed. - PostgreSQL
array_boundsnode now usesemptynode instead of emptylist_exprnode to represent missing number in definition likeINT[]. - Renamed
quantifierfield inquantifier_exprnode toquantifierKwfor consistency with other keyword-containing fields. - Dropped unused
pair_exprnode.
New Features
- Named function arguments are now supported for PostgreSQL.
Bugfixes
- The
rowsKwfield offetch_clausenode is now mandatory. It was always present already, now also correct in type definition. - Fixed parsing of PostgreSQL
GROUP BY DISTINCT - Fixed parsing of MySQL full text match expressions.
0.19.0
Breaking changes
- Unary
+is now parsed as an operator, not as part of a number data_typehas been renamed tonamed_data_typeselect_clausecolumns are now optionalSymbolOperatortype is now plain string (because it needs to accommodate custom PostgreSQL operators)RowConstructortype is now part ofExprtype
SQLite bugfixes
- Support unicode letters in SQLite identifiers
Improved PostgreSQL support
- Use the actual Postgres reserved words list
- Nested block-comments
- Remove incorrect #-comment support from Postgres
- Strings:
- Dollar-quoted strings
- String with C-style escapes
- Unicode strings
- Repeated-quote escapes in E-strings
- Bit-string blobs
- Identifiers:
- Unicode identifiers
- Literals:
- JSON & JSONB literals
- INTERVAL literals
- ROW() constructor
- EXTRACT() expression
- Special paren-less functions
- All keywords can be used in explicit aliases
- Operators:
- IS UNKNOWN
- IS DISTINCT FROM
- ISNULL
- NOTNULL
- % operator
- ^ operator
- || operator
- Bitwise ~ and # operators
- ILIKE
- BETWEEN SYMMETRIC
- SIMILAR TO
- IS NORMALIZED
- AT TIME ZONE
- COLLATE
- Array-access operator
- Array-slice operator
- :: cast operator
- All the builtin PostgreSQL operators
- Almost fully correct PostgreSQL operator precedence
- Types:
- All builtin data types
- Special Object Identifier types
- multi-dimensional array types
- TIME types WITH/WITHOUT TIME ZONE
- INTERVAL type
- Custom data types
- SELECT support:
- Support NULLS FIRST/LAST
- LIMIT offset,count is not supported
- Support FETCH..OFFSET
- Support FOR-clause
- Support INTO TABLE clause
- Support empty SELECT
- Support GROUP BY DISTINCT
- Support LIMIT ALL
- Support basic TABLE clause
- Basic TRUNCATE support
- Basic ANALYZE support
- Basic EXPLAIN support
- Basic EXECUTE support
Improved MySQL & MariaDB support
- Support FOR-clause in MySQL and MariaDB
- Support LOCK IN SHARE MODE in MySQL/MariaDB
0.18.0
Breaking changes
columnsfield has been moved frominsert_clauseto newinsert_columns_clause.
This is because MySQL allowspartition_clauseto be optionally placed betweeninsert_clauseand the list of columns.truncateTableKwintruncate_stmthas been replaced withtruncateKwandtableKwfields.
Improved MySQL/MariaDB support
- Support INSERT..SET
- Support PARTITION clause in INSERT
- Support TABLE statements
- Support ON DUPLICATE KEY UPDATE clause
- Support row and columns aliases in INSERT
- Support VALUES() function
- Support RENAME TABLE statement
- Support basic ALTER VIEW
- Support unicode and $ in identifiers
- Allow identifiers to start with $
Initial PostgeSQL support
Experimental support for Postgres. This is really more on the level of "please don't use it".
- double-quoted identifiers
- HEX numbers
- Basic Postgres strings
- basic INSERT statement
- For now support the same data types as SQLite
- Basic transactions
- unicode and $ in identifiers
- binary numbers
- octal numbers
- Basic array literals