Skip to content

Releases: nene/sql-parser-cst

0.28.1

05 Aug 07:30
Compare
Choose a tag to compare

Improvements

  • Support MySQL set syntax (thanks to YuMuuu) #81

Continuous integration improvements

  • Add Prettier check setting (thanks to YuMuuu) #83
  • Add Node 18 and 20 to CI (tanks to YuMuuu) #82

0.28.0

26 Mar 14:25
Compare
Choose a tag to compare

Breaking changes

  • Use TriggerEventExpr instead of plain TriggerEvent (d5ca16d)
  • Extract timeKw from TriggerEvent (9e0d309)
  • Extract TriggerTarget from TriggerEvent (d37a94b)
  • Rename TriggerCondition to WhenClause (7cd0758)
  • Replace CreateTriggerStmt.eachKw and .when fields with .clauses (56a69b4)
  • Don't parse unicode escapes in PostgreSQL unicode strings and identifiers (f715a15)

Improved PostgreSQL support

  • Support FILTER() in aggregate functions
  • Revert an accidental change to row_constructor syntax
  • Support PostgreSQL TRIGGER syntax:
    • Support CREATE TRIGGER
    • Support REFERENCING clause in TRIGGER
    • Support trigger timing clause
    • Support trigger FROM clause
    • Support FOR EACH clause
    • Support TRUNCATE event
  • Support ALTER PROCEDURE & ALTER FUNCTION
  • Support newline-separated strings, E'strings' and U&'strings'
  • Support UESCAPE in unicode strings & identifiers
  • Support underscores in number literals
  • Update keywords list for PostgreSQL 16 (add SYSTEM_USER)

0.27.1

13 Feb 19:44
Compare
Choose a tag to compare

New parameter type: $nr

  • The paramTypes option now accepts "$nr", to match parameters in the form of $1, $2, $3

0.27.0

07 Feb 16:32
Compare
Choose a tag to compare

Breaking changes

  • Various changes to AlterActionAddConstraint node to support BigQuery ADD CONSTRAINT IF NOT EXISTS syntax (72dadd1)
  • Moved ReindexStmt from AllSqliteNodes to AllIndexNodes (79b68c2)
  • Moved IndexSpecification from AllConstraintNodes to AllIndexNodes (2ba172f)
  • Moved IndexIncludeClause from AllConstraintNodes to AllIndexNodes to support INCLUDE (...) in CREATE INDEX (bde541a)
  • CreateIndexStmt.name field is now optional (e90647d)
  • The CreateViewStmt.columns field now contains list of ColumnDefinition nodes instead of just list of Identifier nodes. (1ba2459)

Support for latest BigQuery (as of 31. January 2024)

  • PRIMARY KEY constraint
  • FOREIGN KEY constraint
  • ALTER TABLE .. DROP PRIMARY KEY
  • ALTER TABLE .. DROP CONSTRAINT
  • NOT ENFORCED modifier in PRIMARY/FOREIGN KEY
  • ALTER TABLE .. ADD CONSTRAINT IF NOT EXISTS
  • ALTER VIEW .. ALTER COLUMN .. SET OPTIONS()
  • OPTIONS() in CREATE VIEW columns list
  • CREATE MATERIALIZED VIEW AS REPLICA OF
  • VECTOR_SEARCH() function
  • CREATE VECTOR INDEX
  • GROUPING() function
  • GROUP BY .. GROUPING SETS / CUBE / ROLLUP
  • quantified LIKE operator

Improved PostgreSQL support

  • CREATE INDEX statement
  • DROP INDEX statement
  • ALTER INDEX statement
  • REINDEX statement
  • Parameters for opclass (mainly in the context of CREATE INDEX)

0.26.0

03 Feb 14:16
Compare
Choose a tag to compare

Breaking changes

  • Replace TableKind, ViewKind and SequenceKind nodes with RelationKind.

Bugfixes

  • The above also fixes the issue of CreateViewStmt.kind field containing TableKind not ViewKind (#68)

0.25.0

02 Feb 09:36
Compare
Choose a tag to compare

Breaking changes

  • Introduced AlterTableAllInTablespaceStmt alongsideAlterTableStmt statement. This means the addition of AllAlterTableNodes and AllAlterTableStatements types (7c546fd)
  • Renamed WithStorageParametersClause to PostgresqlWithOptions (4052303)
  • Renamed AlterActionSetOptions to AlterActionSetBigqueryOptions (b21538f)
  • All VIEW nodes are now exported as AllViewNodes, the AllViewStatements is still exported, but no more includes all
    view-related nodes. (0fcf413)
  • Replaced *Kw fields in CreateViewStmt with kinds: ViewKind[] (c8beba7)
  • Renamed CreateTableTablespaceClause to TablespaceClause (f2f6b79)
  • Renamed CreateTableWithDataClause to WithDataClause (32c64f1)
  • Replaced materializedKw field with kind in CreateViewStmt & DropViewStmt (b636853)
  • Renamed DropSchemaStmt.name field to schemas (e41a9fc)
  • AlterViewStmt.actions now contains ListExpr (4ab708d)
  • Renamed AlterActionRenameTable to AlterActionRename (2aa2314)
  • Renamed CreateSchemaStmt.options field to clauses (a3aa401)
  • CreateSchemaStmt.name field is now optional (397b146)
  • Renamed TruncateStmt.cascadeOrRestrictKw field to behaviorKw (0d7eee4)

Improved PostgreSQL support

  • Finalized support for CREATE TABLE
  • Full support for CREATE FOREIGN TABLE
  • Full support for ALTER TABLE
  • Full support for CREATE/DROP/ALTER SEQUENCE
  • Full support for CREATE/ALTER/DROP VIEW
  • Full support for CREATE/ALTER/DROP MATERIALIZED VIEW
  • Full support for REFRESH MATERIALIZED VIEW
  • Full support for ALTER/DROP SCHEMA
  • Nearly full support for CREATE SCHEMA (only missing support of nested CREATE TRIGGER and GRANT statements)

0.24.0

27 Jan 12:21
Compare
Choose a tag to compare

Breaking changes

  • Removed procedure_param node. The function_param node is now used in both CREATE FUNCTION and CREATE PROCEDURE statements.
  • function_param node now contains the mode field that was part of procedure_param.
  • name field of function_param is now optional.

Improved PostgreSQL support

  • Full support for
    • CREATE FUNCTION
    • DROP FUNCTION
    • CREATE PROCEDURE
    • DROP PROCEDURE
    • See #63 for details.

Other changes

  • block_stmt node now contains optional atomicKw field. To allow for PostgreSQL-specific BEGIN ATOMIC ... END syntax.

0.23.0

17 Jan 12:12
Compare
Choose a tag to compare

Breaking changes

  • The constraint_deferrable node has been replaced with array of constraint_modifier nodes.
    Accordingly the deferrable field in constraint node has been renamed to modifiers.
  • onConflict field has been replaced with clauses array.
    The affects: constraint_primary_key, constraint_unique, constraint_check, constraint_not_null.
  • Various *Kw fields have been replaced with kind field that contains table_kind node:
    • in create_table_stmt: temporaryKw, unloggedKw, externalKw, snapshotKw, virtualKw.
    • in drop_table_stmt: temporaryKw, externalKw, snapshotKw.
    • in into_table_clause: temporaryKw, unloggedKw.
  • The sort_specification node has been replaced with index_specification node in places that reference indexes.
    This effects: constraint_primary_key, create_index_stmt, upsert_clause.

Bugfixes

  • MySQL column KEY constraint is now parsed as constraint_primary_key (instead of constraint_index).
  • doKw field in upsert_clause now has correct type: Keyword<"DO"> (instead of Keyword<"DOR">).

Improved MySQL/MariaDB support

  • Improved CREATE TABLE support:

    • Support index name in FOREIGN KEY
    • Support TABLESPACE & STORAGE options
    • Support UNION option
    • Support [NOT] ENFORCED modifier on CHECK() constraint
  • Improved ALTER TABLE support:

    • Support ALTER COLUMN (SET {VISIBLE | INVISIBLE})
    • Support ADD CONSTRAINT
    • Support DROP CONSTRAINT
    • Support ALTER CONSTRAINT

Improved PostgreSQL support

  • Almost complete CREATE TABLE support:

    • Support DEFAULT expr
    • Support STORAGE constraint
    • Support COMPRESSION constraint
    • Support GENERATED AS IDENTITY
    • Support UNIQUE NULLS [NOT] DISTINCT
    • Support SET NULL/DEFAULT with columns inside REFERENCES action
    • Support GLOBAL|LOCAL TEMP TABLE
    • Support UNLOGGED TABLE
    • Support NO INHERIT constraint modifier
    • Support CREATE TABLE .. INHERITS ()
    • Support PARTITION BY clause
    • Support PARTITION OF
    • Support MINVALUE & MAXVALUE FOR VALUES
    • Support FOR VALUES WITH ... MODULUS & REMAINDER
    • Support ON COMMIT clause
    • Support TABLESPACE clause
    • Support USING clause
    • Support WITH clause
    • Support WITHOUT OIDS clause
    • Support CREATE TABLE .. OF type
    • Support EXCLUDE constraint
    • Support LIKE clause inside columns list
    • Support index parameter clauses
    • Support WITH OPTIONS column definitions
    • Support CREATE TABLE AS .. WITH [NO] DATA
  • Basic ALTER TABLE support:

    • 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
  • Basic CREATE/DROP INDEX support

0.22.1

10 Jan 13:12
Compare
Choose a tag to compare

Bugfix

  • Fix errors when parsing of SQLite builtin functions: glob(), like(), replace() #53

0.22.0

09 Jan 14:17
Compare
Choose a tag to compare

Breaking changes

  • Renamed TruncateStmt.table field to tables which now contains ListExpr
  • Moved ReturningClause and ClusterByClause types from AllSelectClauses to AllOtherClauses
  • Renamed UpsertClause.columns field to conflictTarget
  • Divided MergeStmt to MergeStmt and MergeClause (to accommodate WithClause inside MergeStmt)
  • Renamed MergeActionInsert.values field to clauses

Improved PostgreSQL support

  • Full support for UPDATE statement
    • Support [ONLY] table [*]
    • Support SET col = DEFAULT
    • Support WHERE CURRENT OF clause
  • Full support for DELETE statement
    • Support [ONLY] table [*]
    • Support USING clause
    • Support WHERE CURRENT OF clause
  • Full support for TRUNCATE statement
    • Support [ONLY] table [*]
    • Support multiple tables
    • Support CASCADE/RESTRICT
    • Support RESTART/CONTINUE IDENTITY
  • Full support for MERGE statement
    • Support WITH clause
    • Support [ONLY] table [*]
    • Support OVERRIDING clause
    • Support INSERT DEFAULT VALUES
    • Support DO NOTHING action
  • Almost full support for INSERT statement
    • Support ON CONFLICT clause
    • Support ON CONFLICT (expr)
    • Support ON CONFLICT ON CONSTRAINT
    • Support OVERRIDING clause

Bugfixes

  • Fixed some serious performance regressions, especially when parsing PostgreSQL (#52)
  • YEAR_MONTH keyword is now case-insensitive (like all others)