Skip to content

Releases: nene/sql-parser-cst

0.21.2

07 Jan 18:28
Compare
Choose a tag to compare
  • Support parsing of PostgreSQL table function call with alias and column definitions #51
  • Made the asKw field in func_call_with_column_definitions node optional and changed type of funcCall field.

0.21.1

07 Jan 10:49
Compare
Choose a tag to compare

Fix parsing of SQLite PRIMARY KEY { ASC | DESC }.

0.21.0

06 Jan 22:03
Compare
Choose a tag to compare

Breaking changes

  • Replace distinctKw, hints and asStructOrValueKw fields in select_clause with modifiers field
    • Rename mysql_hint to mysql_modifier
    • Parse DISTINCT and ALL not as plain keywords, but as new separate nodes
    • Parse AS STRUCT / VALUE as select_as_struct / select_as_value nodes.
  • Rename hints field to modifiers in insert_clause, update_clause, delete_clause.
  • Replace plain ASC/DESC keyword with sort_direction_* nodes (both in order_by_clause and constraint_primary_key)
  • Change tablesample_expr to allow for custom methods, changing type of tablesampleKw field
  • Remove single ROLLUP() in GROUP BY restriction, changing the type of columns field

PostgreSQL support

  • Query syntax:
    • Support UPDATE, INSERT, DELETE inside WITH clause
    • Support GROUP BY GROUPING SETS, CUBE(), ()
    • Support CYCLE clause in WITH
    • Support SEARCH clause in WITH
    • Support ORDER BY .. USING operator
    • Support column aliases in table aliases
    • Support table function with column definitions
    • Support ROWS FROM
    • Support LATERAL subqueries and table functions
    • Support REPEATABLE clause in TABLESAMPLE
    • Support table * and ONLY table inheritance syntax
    • Support SELECT DISTINCT ON ()
  • Operators:
    • Support := syntax for named function arguments
    • Support ~ as both a unary and binary operator
    • Support OPERATOR() syntax

Bugfixes

  • Properly support full table names in TABLE clause/statement
  • Restrict the type of expr field in common_table_expr node
  • Remove ! operator support from SQLite
  • Fix ~ operator precedence in PostgreSQL

Internals

  • Switch to Peggy 3

0.20.0

31 Dec 12:31
Compare
Choose a tag to compare

Breaking changes

  • Removed insert_columns_clause node. Reintroduced columns field to insert_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. The partition_clause node has been removed.
  • PostgreSQL array_bounds node now uses empty node instead of empty list_expr node to represent missing number in definition like INT[].
  • Renamed quantifier field in quantifier_expr node to quantifierKw for consistency with other keyword-containing fields.
  • Dropped unused pair_expr node.

New Features

  • Named function arguments are now supported for PostgreSQL.

Bugfixes

  • The rowsKw field of fetch_clause node 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

28 Dec 14:41
Compare
Choose a tag to compare

Breaking changes

  • Unary + is now parsed as an operator, not as part of a number
  • data_type has been renamed to named_data_type
  • select_clause columns are now optional
  • SymbolOperator type is now plain string (because it needs to accommodate custom PostgreSQL operators)
  • RowConstructor type is now part of Expr type

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

30 Oct 09:02
Compare
Choose a tag to compare

Breaking changes

  • columns field has been moved from insert_clause to new insert_columns_clause.
    This is because MySQL allows partition_clause to be optionally placed between insert_clause and the list of columns.
  • truncateTableKw in truncate_stmt has been replaced with truncateKw and tableKw fields.

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

0.17.1

27 Mar 13:39
Compare
Choose a tag to compare

Performance

  • Improve performance of parsing nested parenthesis, especially in MySQL #38

0.17.0

27 Mar 08:04
Compare
Choose a tag to compare

Breaking changes

  • Renamed common_table_expression to common_table_expr (for consistency with other _expr node types).

New features

  • paramTypes now supports new type "@`name`" #37
  • cstVisitor now supports skipping child nodes by returning VistorAction.SKIP.