Commit graph

584 commits

Author SHA1 Message Date
eitsupi
33b12acce7
feat: add DuckDB dialect (#878)
* feat: add DuckDB dialect

* formatting

* fix conflict

* support // in GenericDialect

* add DucDbDialect to all_dialects

* add comment from suggestion

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

* fix: support // in GenericDialect

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-05-18 14:57:29 -04:00
Mustafa Akur
482a3ad417
Add support for multiple expressions, order by in aggregations (#879)
* Add support for multiple expressions, order by in aggregations

* Fix formatting errors

* Resolve linter errors
2023-05-17 13:04:33 -04:00
Armin Primadi
f15da8772e
Make Expr::Interval its own struct (#872)
* Make Expr::Interval its own struct

* Add test interval display

* Fix cargo fmt
2023-05-09 20:42:03 -04:00
Aljaž Mur Eržen
0113bbd924
Test trailing commas (#859)
* test: add tests for trailing commas

* tweaks
2023-05-01 08:31:17 -04:00
Aljaž Mur Eržen
3b1076c194
Support DISTINCT ON (...) (#852)
* Support "DISTINCT ON (...)"

* a test

* fix the merge
2023-04-27 15:34:54 -04:00
AviRaboah
f72e2ec382
Support multiple-table DELETE syntax (#855) 2023-04-27 11:41:20 -04:00
Andrew Lamb
00d071286b
Move tests from parser.rs to appropriate parse_XX tests (#845)
* Move tests from parser.rs to appropriate parse_XX tests

* move to postgres tests

* move more tests
2023-04-10 09:48:23 -04:00
pawel.leszczynski
29dea5d017
support PIVOT table syntax (#836)
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
2023-03-26 07:33:35 -04:00
Maciej Skrzypkowski
a1b7341b87
Non-Latin characters support (#840)
* Non latin characters

---------

Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>

* Test for mysql

---------

Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>
2023-03-23 07:07:17 -04:00
Andrew Lamb
7f4c9132d7
Fix table alias parsing regression in 0.31.0 by backing out redshift column definition list (#827)
* Fix table alias parsing regression

* Revert "Support redshift's columns definition list for system information functions (#769)"

This reverts commit c35dcc93a7.
2023-03-06 11:43:22 -05:00
Mykhailo Bondarenko
1cf913e717
feat: Support PostgreSQL exponentiation. (#813)
* Add Postgres exponent operator

* Parse caret as BinaryOperator::PGExp in PostgreSQL

* Update sqlparser_postgres.rs

* update tests to support PGExp

* cargo fmt

* improve extensibility

* cargo fmt

* redundant code and documentation lionks
2023-03-02 10:39:39 -05:00
Y Togami
fbbf1a4e84
feat: support BIGNUMERIC of bigquery (#811)
* add tests

* bignumeric data type

* bignumeric keyword

* fix doc

* add exact_number_info

* fix doc

* check result string
2023-03-02 10:38:00 -05:00
Maciej Skrzypkowski
c35dcc93a7
Support redshift's columns definition list for system information functions (#769)
* parsing of redshift's column definition list for
pg_get_late_binding_view_cols
pg_get_cols
pg_get_grantee_by_iam_role
pg_get_iam_role_by_user

* Renamed ColsDefinition to TableAliasDefinition

added generic dialect

* Tests fixed

* Visitor for IdentPair

* Parsing redshift table alias based on indentifier and
parentheses instead of function name

* fix clippy

---------

Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-02-17 14:04:59 -05:00
Y Togami
79009f5448
feat: support JSON keyword (#799)
* feat: support json keyword for bigquery

* chore: fix test

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-02-17 13:46:30 -05:00
Y Togami
b31ede7733
chore: fix clippy error in ci (#803)
* chore: fix clippy error in ci

* chore: fix fmt
2023-02-17 13:24:50 -05:00
henry
61c661c234
Support ALTER INDEX {INDEX_NAME} RENAME TO {NEW_INDEX_NAME} (#767)
* test: add a case `rename_index`

* feat: add AlterIndex match arm

* fix: remove todo with self.expected

* chore: add comment to unreachable
2022-12-28 08:35:27 -05:00
Jeffrey
f0870fd315
Enable grouping sets parsing for GenericDialect (#771) 2022-12-28 08:31:39 -05:00
Andrew Lamb
79d0baad73
Add configurable recursion limit to parser, to protect against stack overflows (#764) 2022-12-28 08:29:51 -05:00
Jeffrey
2c20ec0be5
Support parsing scientific notation (such as 10e5) (#768) 2022-12-28 08:28:53 -05:00
Audun Skaugen
fb02344131
Generalize locking clause (#759)
Postgres supports more generalized locking clauses, for example:
FOR UPDATE OF <table_name> SKIP LOCKED

also, multiple locking clauses. Generalize the parser to support these.

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-12-13 17:19:07 -05:00
Ziinc
d420001c37
fix: unnest join constraint with alias parsing for BigQuery dialect (#732)
* fix: unnest join constraint with alias parsing for BigQuery dialect

* chore: fix failing tests
2022-12-13 16:44:45 -05:00
Wei-Ting Kuo
bda8268e56
add keyword NANOSECOND (#749) 2022-12-06 15:29:41 -05:00
Augusto Fotino
b3688513eb
feat: add support for except clause on wildcards (#745) 2022-12-05 14:03:59 -05:00
Sarah Yurick
528b3f2234
Support CREATE TABLE x AS TABLE y (#704)
* first commit

* fix style and edit test

* fix test?

* remove unnecessary logic

* refactor implementation

* codestyle

* add schema support

* codestyle and lint

* Apply suggestions from code review

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

* PartialOrd and Ord

* clean up parser logic

* codestyle and lint

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-12-01 09:56:14 -05:00
Aljaž Mur Eržen
8e1c90c0d8
Support MySQL ROWS syntax for VALUES (#737)
* Adapt VALUES to MySQL dialect

* Update src/ast/query.rs

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

* remove *requirement* for ROW

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-12-01 09:46:55 -05:00
yuval-illumex
a422116b89
inital commit (#736) 2022-11-30 13:33:15 -05:00
mao
316359760d
Support USING method when creating indexes. (#731)
* fix: create index using function

* fix: code style

Co-authored-by: yangjiaxin <yangjiaxin@qianxin.com>
2022-11-30 13:17:38 -05:00
mingmwang
96bca38fae
Support SEMI/ANTI JOIN syntax (#723) 2022-11-30 12:57:45 -05:00
Augusto Fotino
fa6bd01b19
Support EXCLUDE support for snowflake and generic dialect (#721)
The exclude clause can be used after a possibly qualified on SELECT
2022-11-30 12:29:43 -05:00
Augusto Fotino
886875f3bf
Support for IF NOT EXISTS in ALTER TABLE ADD COLUMN (#707) 2022-11-29 15:37:14 -05:00
Wei-Ting Kuo
bae682255d
add set time zone sometimezone as a exception while parsing keyword::set (#727)
* add set time zone sometimezone as a exception while parsing keyword::set

* remove redundant parentheses

* add Statement::SetTimeZone

* delete useless comments
2022-11-28 16:16:08 -05:00
Sarah Yurick
57083a0df1
Fix interval parsing logic and precedence (#705)
* initial fix

* add comma

* add test

* style

* add more tests

* codestyle fix
2022-11-22 07:45:47 -05:00
unvalley
4b1dc1abf7
Support UPDATE ... FROM ( subquery ) in some dialects (#694)
* Apply UPDATE SET FROM statement for some dialects

* Add GenericDialect to support

* Test SnowflakeDialect

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-11-11 16:37:09 -05:00
main()
814367a6ab
Implement ON CONFLICT and RETURNING (#666)
* Implement RETURNING on INSERT/UPDATE/DELETE

* Implement INSERT ... ON CONFLICT

* Fix tests

* cargo fmt

* tests: on conflict and returning

Co-authored-by: gamife <gamife9886@gmail.com>
2022-11-11 16:15:31 -05:00
Augusto Fotino
65c5a37bce
feat: add precision for TIME, DATETIME, and TIMESTAMP data types (#701)
Now all those statements are both parsed and displayed with precision
and timezone info. Tests were added to the ones presented in the ANSI
standard.
2022-11-11 16:06:57 -05:00
SuperBo
87b4a168cb
Parse ARRAY_AGG for Bigquery and Snowflake (#662) 2022-11-11 15:25:07 -05:00
omer-shtivi
0428ac742b
Add MySql, BigQuery to all dialects (#697)
* Add MySql, BigQuery to all dialects

* move unsupported on mysql from common
2022-11-07 15:32:47 -05:00
unvalley
f7817bc7c2
Support DISTINCT for SetOperator (#689)
* Update SetOperation field all to op_option

* Implement parse_set_operator_option

cargo fmt

Fix parse_set_operator_option after next_token

* Add test for parsing union distinct

* Rename to SetQualifier and fix fmt space

* Add None to SetQualifier

* Update parse method

* Rename to SetQuantifier

* Rename parse_set_operator_option parse_set_operator

* Fix test to parse union, except, intersect

* Add some comments to SetQuantifier

* Fix comment
2022-11-07 07:05:59 -05:00
yuval-illumex
0f7e144890
Support the ARRAY type of Snowflake (#699)
* Snowflake Array

* Use the array data type

* Try to fix build

* Try to fix build

* Change Array to option

* Remove unused import
2022-11-04 10:25:25 -04:00
AugustoFKL
1b3778e2d5
feature!: added NUMERIC and DEC ANSI data types, and now the DECIMAL (#695)
type prints DECIMAL instead of NUMERIC.

BREAKING CHANGE: enum DATA TYPE variants changed, changing any API that
uses it.
2022-10-31 15:22:34 -04:00
Sarah Yurick
f0646c8c1a
add Date keyword (#691) 2022-10-31 15:20:57 -04:00
AugustoFKL
2aba3f8c91
Adding MySQL table option {INDEX | KEY} to the CREATE TABLE definiton (partial). (#665)
Theoretically the behavior should be the same as CREATE INDEX, but we
cannot make that assumption, so the parse is (almost) identical as the
input.

Breaking changes:
- Now HASH and BTREE are KEYWORDS, and using them as names can result in
  errors.
- Now 'KEY' and 'INDEX' column names start the parsing of a table constraint if unquoted for the Generic dialect. This results in possible conficts if canonical results are compared for all dialects if a column is named 'key' without quotes.
2022-10-19 17:24:38 -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
Francis Du
a59874136d
Support cache/uncache table syntax (#670)
* feat: support cache/uncache table syntax

* fix: support the full cache table syntax
2022-10-15 07:53:43 -04:00
Mustafa akur
427bec4ccc
Support for INTERVAL inside window frames (#655)
* Add support to for INTERVAL inside window queries

* Remove the unnecessary ancillary struct Interval

* Convert Window Frame Bound to Expr

* remove unnecessary changes

* remove unnecessary changes

Co-authored-by: Mehmet Ozan Kabak <ozankabak@gmail.com>
2022-10-15 06:34:52 -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
Sarah Yurick
cb397d19f9
Support CEIL(expr TO DateTimeField) and FLOOR(expr TO DateTimeField) (#635)
* support ceil/floor to datetime

* Update mod.rs

* Update parser.rs

* murphys law

* Update sqlparser_common.rs

* possible fix?

* remove question mark

* ceil to floor

* Update mod.rs

* Apply suggestions from code review

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

* refactor into parse_ceil_floor_expr

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-10-06 15:21:25 -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
1ced0f6304
645 New schema name structure (#646) 2022-10-03 08:38:01 -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