Commit graph

203 commits

Author SHA1 Message Date
Andrew Lamb
a9d7f7af1f
Improve docs for KILL statement (#481) 2022-05-02 17:49:06 -04:00
Dmitry Patsura
f5980cd30f
feat: Support KILL statement (#479) 2022-05-02 14:04:33 -04:00
yuval-illumex
7732c34b19
Add support in IS boolean filter (#474)
* Add support in IS TRUE IS FALSE

* Fix lint

* Add test for is false
2022-05-02 14:02:28 -04:00
Maciej Obuchowski
525ba527bb
snowflake: add qualify expression (#465)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
2022-04-29 14:11:11 -04:00
yuval-illumex
8f4f01e517
Add Support in the "Position" Function (#463)
* Add support in the position function

* Add Test

* Add lint fixes

* Remove if

* Change from to in

* Remove special method for position

* Fix lint

* PR Review
2022-04-25 06:32:16 -04:00
George Andronchik
0924870d11
Support global,local, on commit for create temporary table (#456)
* feat: add global,local / on commit for create temp tables

* chore: minor refactor

* chore: clippy fix
2022-04-22 07:58:39 -04:00
yuval-illumex
278345d21a
Add support of NVARCHAR data type (#462)
* Add support of nvarchar data type

* Change the format type with capitals

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

* Add Test

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-04-20 17:25:50 -04:00
Poonai
d035784bdf
Add support for postgres json operators ->, ->>, #>, and #>> (#458)
* add support for postgres json selection

Signed-off-by: password <rbalajis25@gmail.com>

* fix clippy

Signed-off-by: password <rbalajis25@gmail.com>

* add support for postgres `#>` and `#>>` json operator

* fix clippy

Signed-off-by: poonai <rbalajis25@gmail.com>

* resolve comments

Signed-off-by: password <rbalajis25@gmail.com>
2022-04-19 15:46:56 -04:00
slhmy
8f207db059
Support 'SET ROLE' statement (#455) 2022-04-13 14:45:53 -04:00
Runji Wang
bfd416d978
Add support for more postgres COPY options (#446)
* implement parsing COPY statement

* support COPY option syntax before PostgreSQL version 9.0

Signed-off-by: Runji Wang <wangrunji0408@163.com>

* update COPY tests

Signed-off-by: Runji Wang <wangrunji0408@163.com>

* improve docs for COPY

Signed-off-by: Runji Wang <wangrunji0408@163.com>

* test and fix AS in COPY

Signed-off-by: Runji Wang <wangrunji0408@163.com>

* recover original test cases

* fix cargo clippy
2022-04-03 06:37:12 -04:00
slhmy
fd8f2df10d
Support Update Set From statement (#450) 2022-04-02 06:34:59 -04:00
Matthew Turner
803fd6c970
Add CREATE DATABASE test and parsing (#451)
* Add test

* Fix CreateDatabse parsing

* Linting

* Cleanup for code style
2022-04-01 13:32:38 -04:00
Maciej Obuchowski
d38c30e9ff
add SELECT INTO statement variation (#447)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
2022-03-30 16:01:55 -04:00
Matthew Turner
b68e9a3801
Add support for COPY TO (#441)
* Start adding COPY TO

* Fix statement and add tests

* Merge copy statements

* Remove extra line

* Clippy

* Cleanup
2022-03-22 18:21:44 -04:00
Poonai
12a3e97ef3
add support for SAVEPOINT statement (#438) 2022-03-13 03:29:26 -04:00
Simon Liu
497a3b0e1b
Fixed the bug that the access parsing is wrong when multiple query conditions contain arrays or map. (#433) 2022-03-12 14:29:37 -05:00
Maciej Obuchowski
6b55e51101
add support for MERGE statement (#430)
* add support for MERGE statement

Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>

* fix lint errors

Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
2022-03-12 14:28:57 -05:00
Yang Jiang
c688bbb4de
extract operator: add support for week keywords (#436) 2022-03-12 14:17:56 -05:00
Andrew Lamb
a28bbcd74c
Allow array to be used as a function name again (#432)
* Allow `array` to be used as a function

* clarify code, add docstrings

* fix docs

* cleanup

* fmt
2022-03-08 13:25:48 -05:00
Simon Liu
3f5619446f
Support for ClickHouse array types (e.g. [1,2,3]) (#429) 2022-03-08 11:44:32 -05:00
Wataru Kurashima
994b86a45c
mysql unsigned datatype (#428)
* support MySQL UNSIGNED

* fix: 🐛 `unsigned` is not column option

* test: 💍 add `unsigned` test

* fix: 🐛 `unsigned` is not column option

* feat: 🎸 declare unsigned data_types

* feat: 🎸 display unsigned

* fix: 🐛 unsigned is not column type option

* feat: 🎸 parse_data_type can parse unsigned

* feat: 🎸 int or decimal or float is unsigned selectable

* fix: 🐛 FLOAT/DOUBLE/DECIMAL + UNSIGNED is not recommended

https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html

* test: 💍 add test

* style: 💄 fmt
2022-03-07 17:01:48 -05:00
Maciej Obuchowski
3af3ca07b6
extract operator: add support for Postgres keywords (#427)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
2022-03-07 10:03:28 -05:00
Yoshiyuki Komazaki
0d1c5d1205
Support IN UNNEST(expression) (#426)
* feat: support `IN UNNEST(expression)`

* Add test for NOT IN UNNEST
2022-03-01 08:53:01 -05:00
Wataru Kurashima
2ebe18a94e
Support COLLATION keywork on CREATE TABLE (#424)
* support table definition's collate

* add table collate test
2022-02-28 14:04:47 -05:00
gamife
0b5178d7e7
feat: add FOR UPDATE/FOR SHARE clause (#418)
* feat: add FOR UPDATE/FOR SHARE clause

* refactor: LockType enum variant name

Co-authored-by: gamife <gamife9886@gmail.com>
2022-02-24 06:39:38 +01:00
gamife
899f91b1f6
feat: add arg placeholder (#420)
Co-authored-by: gamife <gamife9886@gmail.com>
2022-02-17 07:55:21 -05:00
gamife
1da49c15c7
Support array expressions such as ARRAY[1,2] , foo[1] and INT[][] (#419)
* feat: add array expression

* test: add back the the existing test

Co-authored-by: gamife <gamife9886@gmail.com>
2022-02-17 07:21:11 -05:00
Andrew Lamb
d7f4f1aac9
Support MySQL style LIMIT X, Y (#415) 2022-02-09 06:44:51 -05:00
Andrew Lamb
ff558eeb61
Add Expr::tuple + parsing (#414) 2022-02-08 10:54:27 -05:00
Evgeny
8a3544abae
Fix panic with GRANT/REVOKE in CONNECT, CREATE, EXECUTE or TEMPORARY (#401)
* fix inconsistency between parse_grant_permissions and matched keywords

* Make it clear the error is an internal problem

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-02-08 10:50:55 -05:00
tvallotton
c4cbc8340a
Support DROP CONSTRAINT [ IF EXISTS ] <name> [ CASCADE ] (#396)
* adding support for DROP CONSTRAINT [ IF EXISTS ] <name>

* implementing [ CASCADE ] for DROP CONSTRAINT
2022-02-08 10:34:09 -05:00
Jakob Truelsen
e4959696b5
Support CHARSET and ENGINE clauses on CREATE TABLE for mysql (#392)
* Add support for SET and ENUM types

See https://dev.mysql.com/doc/refman/8.0/en/set.html
and https://dev.mysql.com/doc/refman/8.0/en/enum.html

* Add support for mysql ENGINE and DEFAULT CHARSET in CREATE TABLE

See https://dev.mysql.com/doc/refman/8.0/en/create-table.html

* Add support for COMMENT and CHARACTER SET field attributes

See https://dev.mysql.com/doc/refman/8.0/en/create-table.html
2022-02-08 10:08:56 -05:00
Poonai
2614576dbf
Add support for FROM <filename>, DELIMITER, and CSV HEADER options for COPY command (#409)
* add additional options for copy command

Signed-off-by: password <rbalajis25@gmail.com>

* cargo fmt

Signed-off-by: password <rbalajis25@gmail.com>
2022-02-07 06:33:28 -05:00
Andrew Lamb
33d4f27bfc
Support OFFSET LIMIT as well as LIMIT OFFSET (#413)
* Inital support in current_timestamp

* Support time functions

* Add Test

* Fix order of offset

* Merge from main

* Fix PR

* Update Test

* Do not allow repeated LIMIT or OFFSET

Co-authored-by: Yuval Shkolar <yuval@illumex.ai>
2022-02-05 07:46:53 -05:00
Tao Wu
929ef2a4b8
fix: export all methods of parser (#397) 2022-02-05 07:26:09 -05:00
Andrew Lamb
5cbf1e797a
Fix new clippy errors (#412) 2022-02-05 06:53:33 -05:00
yuval-illumex
fbc1d9659b
Support parentheses in DISTINCT clause, CURRENT_TIMESTAMP, CURRENT_TIME, and CURRENT_DATE (#391)
* Inital support in current_timestamp

* Support time functions

* Add Test

* Fix PR

* Fix tests

* Add Support for distinct with parentheses

* Fix nightly
2022-02-05 06:39:35 -05:00
Simon Liu
60ad78dafc
Enable map access for function, add ClickHouse dialect (#382)
* 1 Add ClickHouse dialects.
2 Enable map access for function.

* 1 Fixed compilation errors.
2 Modify the code according to @alamb's comments.

* Fixed compilation errors.
2021-12-21 16:16:30 -05:00
Zach Hamlin
9569d1b215
feat: comment and alter column support (#381)
* feat: add support for postgresql comment keyword

* feat: add alter column and rename constraint
2021-12-17 12:19:08 -05:00
Taehoon Moon
823635d2fc
Add FunctionArgExpr and remove Expr::[Qualified]Wildcard, (#378)
* Add FunctionArgExpr and remove Expr::[Qualified]Wildcard,

There is no use case of `Expr::Wildcard` and `Expr::QualifiedWildcard` only except for function argments.
Add `FunctionArgExpr` to have `Wildcard` and `QualifiedWildcard`, and remove wildcards in `Expr`.

* Apply `FunctionArgExpr` to sqlparser_mysql tests
2021-12-15 06:35:37 -05:00
Poonai
4c121a92a6
support for session transaction and transaction snapshot. (#379)
* add support for snapshot id in set transaction

Signed-off-by: poonai <rbalajis25@gmail.com>

* add support for default session transaction characteristics

Signed-off-by: poonai <rbalajis25@gmail.com>

* add additional assertion for parse_set_transaction test

Signed-off-by: poonai <rbalajis25@gmail.com>

* Fix clippy

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2021-12-14 15:13:12 -05:00
Andrew Lamb
82eaae1522
Implement some MySQL specific syntax and extend the UPDATE statement (#375)
* * implement the ON DUPLICATE KEY syntax for MySQL in an INSERT statement

* * add MySQL to the cli example
* remove the dialect check for the ON DUPLICATE KEY insert to support
  custom dialects and unwrap some missing results

* * use the Assignment DataType for the ON DUPLICATE KEY UPDATE

* * add support for table aliases in an UPDATE statement
* add support for JOINS in an UPDATE statement (for MySQL)

* * implement the MySQL ALTER TABLE CHANGE COLUMN syntax

* * fix the formatting of the else * rename the parse_identifiers_strict
  to parse_identifiers_non_keywords

* Parse SUBSTRING calls that are separated with a comma instead of
keywords

* Fix the linting errors

Co-authored-by: Piotr <piotr.morawski@nc-vision.com>
Co-authored-by: Piotr Morawski <contact@peter-morawski.de>
2021-12-10 14:46:11 -05:00
Jiayu Liu
40d67aab87
parse grouping sets, rollup, and cube for postgresql (#366)
* parse grouping sets, rollup, and cube

* add postgresql flag
2021-12-10 14:45:09 -05:00
Ben Cook
d7e84be3e1
Add basic support for GRANT and REVOKE (#365)
* Add basic support for GRANT privileges on tables and sequences

* Cargo fmt

* Make enum for granted privileges

* Implement and use Display for GrantObjects

* Simplify Display for GrantPrivileges

* Add column privileges

* Add second column privilege to test

* Add REVOKE privileges and reformat

* Fix some clippy warnings

* Fix more clippy

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2021-12-08 15:55:23 -05:00
Jiayu Liu
0e1027ce96
fix clippy warnings (#367) 2021-12-08 08:27:00 +01:00
Daniël Heres
0f0b327e97
Implement is [not] distinct from (#361)
* Implement is [not] distinct from

* Simplify message

* Clippy
2021-10-14 18:26:28 +02:00
Qinxuan Chen
c9f8a44b55
Move the keywords module (#352)
* Move the keywords mod from dialect mod into the root of library

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* re-export keywords from dialect for backwards compatiblity

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2021-09-26 07:59:39 -04:00
Guillaume Balaine
d498887a5d
Enable map access for numbers, multiple nesting levels (#356)
* enable integer keys for map access

* enable map access for number keys

* Add tests for string based map access

* MapAccess: unbox single quoted strings to always display double quoted strings for map access

* cargo fmt

* cargo clippy

* Fix compilation with nostd by avoiding format!

* fix codestyle

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2021-09-24 14:22:12 -04:00
John
014b82f03d
Add logical xor (#357) 2021-09-18 06:39:35 -04:00
Qinxuan Chen
a8901becc3
Rname Token::Mult to Token::Mul (#353)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2021-09-16 16:50:10 -04:00