Commit graph

113 commits

Author SHA1 Message Date
sam
bbf32a9e81
Support create sequence with options INCREMENT, MINVALUE, MAXVALUE, START etc. (#681)
* Creat sequence options model

[ INCREMENT [ BY ] increment ]
    [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
    [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
    [ OWNED BY { table_name.column_name | NONE } ]

* Fix for format! not avalable in --target thumbv6m-none-eabi

* Fix for format! not avalable in --target thumbv6m-none-eabi

* Fix for format! not avalable in --target thumbv6m-none-eabi

* Fix for format! not avalable in --target thumbv6m-none-eabi

* Updated parser for sequence options

* Updated parser for sequence options

* Update src/ast/mod.rs

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

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-11-03 09:16:43 -04:00
sam
e3c936a6ce
mod, parser and test cases for CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] (#678) 2022-10-19 17:21:17 -04:00
sam
b32cbbd855
Support drop sequence statement (#673)
* Add ObjectType Sequence

* Drop sequence test cases added.

* Parser and Drop statement Display updated.

* Parser and Drop statement Display updated.

* Fix compile errors

* add new test case
2022-10-15 08:04:19 -04:00
AugustoFKL
cacdf3305f
Add support for unit on char length units for small character string types. (#663)
This results in complete support for ANSI CHARACTER, CHAR, CHARACTER VARYING,
CHAR VARYING, and VARCHAR.
2022-10-11 08:54:15 -04:00
AugustoFKL
777672625f
Replacing the two booleans from 'SET ROLE' to a single enum. (#664)
This way, we don't rely on the parser to have valid structures for that
statement, as the structure itself is valid.
2022-10-10 17:14:37 -04:00
AugustoFKL
f7f14df4b1
647 Adding all ansii character string types, parsing them, and differentiating between each one (#648) 2022-10-04 06:42:29 -04:00
AugustoFKL
95464ec72c
Change TIMESTAMP and TIME parsing so that time zone information is preserved (#641)
* 640 Fixing time zone printing format for TIMESTAMP and TIME

* 640 Removing unnecessary changes

* Update src/ast/data_type.rs

Fix comment typo

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-10-03 08:37:17 -04:00
Andrew Lamb
6afd194e94
Disambiguate CREATE ROLE ... USER and GROUP (#628) 2022-09-27 13:56:29 -04:00
Andrew Lamb
2b21da2439
Add test for optional WITH in CREATE ROLE (#627) 2022-09-27 10:23:33 -04:00
Ben Cook
91087fcba0
Support CREATE ROLE and DROP ROLE (#598)
* Parse GRANT ROLE and DROP ROLE

* Gate create role on dialect

* cargo fmt

* clippy

* no-std

* clippy again
2022-09-27 09:58:36 -04:00
Dmitry Patsura
6d8aacd85b
feat: Support expression in SET statement (#574)
Co-authored-by: Alex Vasilev <vaspiring@gmail.com>
2022-08-18 13:29:55 -04:00
Alex Qyoun-ae
31ba0012f7
Support PostgreSQL array subquery constructor (#566) 2022-08-12 14:08:56 -04:00
Dmitry Patsura
54a29e872d
feat: Parse special keywords as functions (current_user, user, etc) (#561)
* feat: Parse special keywors as functions (current_user, user, etc)

* explain special field
2022-08-11 08:30:06 -04:00
Kaushik Iska
1c64129f76
[postgres] Add support for custom binary operators (#548)
* [postgres] Add support for custom binary operators

More details about operators in general are at:
https://www.postgresql.org/docs/current/sql-createoperator.html. This
patch attempts to parse `SELECT` queries that reference an operator
using `OPERATOR(<optional_schema>.<operator_name>)` syntax.

This is a PostgreSQL extension. There are no provisions for user-defined operators in the SQL standard.

* fix code-review comments and ci failures

* Allow custom operator in generic dialects too

* Parse `OPERATOR` as Vec<String>

* fix: std

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-08-05 13:53:58 -04:00
Dmitry Patsura
6c98228e71
feat: Allow to use >> and << binary operators in Generic dialect (#553) 2022-08-05 06:25:57 -04:00
Chris Allen
7cbbd9188e
Add support for AT TIME ZONE (#539)
* Support for empty array literals

* Added support for AT TIME ZONE

Co-authored-by: Chris Allen <chrisa@indeed.com>
2022-07-18 13:03:01 -04:00
5tan
dea7666086
Boxed Query body to save some stack space (#540) 2022-07-16 07:22:45 -04:00
Andrey Frolov
f29ce10a1a
Distinguish between INT and INTEGER types (#525)
* support integer

* fmt

* Update src/ast/data_type.rs

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

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-06-21 09:32:10 -04:00
Dmitry Patsura
3f1c6426f0
feat: Initial support for DECLARE (cursors) (#509) 2022-06-06 07:22:12 -04:00
Dmitry Patsura
66a3082cb6
feat: Support FETCH (cursors) (#510) 2022-06-04 14:24:36 -04:00
Riccardo Azzolini
d19c6c323c
Fix escaping of trailing quote in quoted identifiers (#505)
* Generalize EscapeSingleQuoteString to arbitrary quote character

* Fix escaping of trailing quote in quoted identifiers

* Add new tests instead of modifying existing tests
2022-05-27 06:25:24 -04:00
Riccardo Azzolini
901f5b974f
Distinguish between tables and nullary functions in FROM (#506) 2022-05-25 16:01:13 -04:00
Dmitry Patsura
2c0886d9fe
feat: Support escaped string literals (PostgreSQL) (#502)
* feat: Support escaped string literals (PostgreSQL)

Signed-off-by: Dmitry Patsura <talk@dmtry.me>

* lint

* escape ', \r, \t

* Update src/ast/value.rs

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

* Update src/tokenizer.rs

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

* test: two slashes

* remove dead code

* test: parsing error

* support generic dialect too (for DF)

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-05-25 14:42:14 -04:00
Andrew Lamb
11046f66e7
Correct typo: indexs to indexes (#492) 2022-05-22 15:03:48 -04:00
Poonai
ed86c6d53d
add support for postgres composite types (#466)
* add support for postgres composite types

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

* fix composite test for bigdecimal feature

Signed-off-by: password <rbalajis25@gmail.com>
2022-05-09 15:12:22 -04:00
Maciej Obuchowski
6d057ef4df
set: allow dots in variables by moving to ObjectName (#484)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
2022-05-09 14:21:20 -04:00
Dmitry Patsura
e68bdae5f2
feat: Allow ArrayIndex for GenericDialect (#480)
* feat: Allow ArrayIndex for GenericDialect

* test array index with generic dialect too
2022-05-04 20:20:45 -04:00
Maciej Skrzypkowski
7fc6361fe8
Add Redshift dialect, handle square brackets properly (#471)
* Redshift square bracket handling

We need to detect `[` or `"` for Redshift quotes around indentifier and at the same time exclude
treating JSON paths as indentifer

* RedshiftSqlDialect documentation update

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

* Renamed _chars to chars

* Fixed warnings

* Missing license

Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-05-04 11:11:00 -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
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
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
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
3f5619446f
Support for ClickHouse array types (e.g. [1,2,3]) (#429) 2022-03-08 11:44:32 -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
Markus Westerlind
34fedf311d
fix: Handle double quotes inside quoted identifiers correctly (#411)
* fix: Handle double quotes inside quoted identifiers correctly

This fixes #410 for standard SQL, however I don't know enough about other dialects to know if they
handle this differently. May need more extensive testing as well.

* refactor: Make quoted identifier parsing a seperate function

* test: Check that quoted identifier tokenization works

Added `pretty_assertions` so that the `assert_eq!` in the tokenization is readable

* test: Check that quoted identifiers work in mysql

* chore: cargo clippy
2022-02-07 10:05:17 -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
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
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
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
Alex Vasilev
77d90d3b85
Support minimum display width for integer data types (#337)
* Support minimum display width for integers

* make fmt happy, updated docstrings
2021-08-29 07:13:10 -04:00
Andy Grove
5ebc06b20c Update links to reflect repository move to sqlparser-rs GitHub org 2021-08-20 17:03:06 -06:00
b41sh
80759a4deb support regex match 2021-08-13 19:50:14 +08:00
Francis Du
07342d5853
Support parsing multiple show variables. (#290)
* feat: support parsing multiple show variables.

* fix: fix fmt error
2021-02-09 21:03:49 +01:00
Stephen Carman
8a214f9919
Implement Hive QL Parsing (#235) 2021-02-04 12:53:20 -07:00
Nickolay Ponomarev
4128dfe1db Introduce tests/test_utils/mod.rs and use it consistently
To share helper macros between various tests/* we added a new module
(tests/macros/mod.rs). This made the prologue to be used in tests quite
long and a little weird:
```
#[macro_use]
#[path = "macros/mod.rs"]
mod macros;
use sqlparser::test_utils::*;
```

This simplifies it to:
```
#[macro_use]
mod test_utils;
use test_utils::*;
```
- and switches all existing tests to the new prologue simultaneously...

...while fixing a few other inconsistencies and adding a few comments
about the way `test_utils` work.
2020-10-12 06:52:00 +03:00