Commit graph

1008 commits

Author SHA1 Message Date
eitsupi
097e7ad56e
feat: Support MySQL's DIV operator (#876)
* feat: MySQL's DIV operator

* fix: do not use `_` prefix for used variable

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-05-17 13:26:14 -04:00
Maximilian Roos
feaa13c9a9
feat: Add custom operator (#868)
* feat: Add custom operator

From #863

- It doesn't parse anything — I'm not sure how to parse ` SELECT 'a' REGEXP '^[a-d]';` with `REGEXP` as the operator... (but fine for my narrow purpose)
- If we need tests, where would I add them?

* Update src/ast/operator.rs

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-05-17 13:12:50 -04:00
Jeffrey
4559d87a82
Add parse_multipart_identifier function to parser (#860)
* Add parse_multipart_identifier function to parser

* Update doc for parse_multipart_identifier

* Fix conflict
2023-05-17 13:04:57 -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
Andrew Kane
ae3b5844c8
Include license file in published crate (#871) 2023-05-09 20:48:57 -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
Okue
b29b551fa1
Fix tiny typo in custom_sql_parser.md (#864) 2023-05-02 07:08:38 -04:00
Andrew Lamb
be85f54ca3
Fix logical merge conflict (#865) 2023-05-02 07:07:56 -04:00
Armin Primadi
0ff863b2c7
Add support for query source in COPY .. TO statement (#858)
* Add support for query source in COPY .. TO statement

* Fix compile error
2023-05-01 15:39:18 -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
5ecf633e31
Add dialect_from_str and improve Dialect documentation (#848)
* Add `dialect_from_str` and improve `Dialect` documentation

* cleanup

* fix compilation with nostd
2023-04-27 11:37:11 -04:00
pawel.leszczynski
d8af92536c
support COPY INTO in snowflake (#841)
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
2023-04-27 11:30:48 -04:00
AviRaboah
3e92ad349f
Support identifiers beginning with digits in MySQL (#856) 2023-04-26 09:27:04 -04:00
Brian Anglin
6b2b3f1f6c
Adds clickhouse to example (#849) 2023-04-12 15:04:46 -04:00
Andrew Lamb
00719e3cf3 (cargo-release) version 0.33.0 2023-04-10 12:13:03 -04:00
Andrew Lamb
28e558c286
Changelog for 0.33.0 (#846)
* Changelog for `0.33.0`

* typo
2023-04-10 12:11:14 -04:00
Coby Geralnik
04d9f3af2e
Added support for Mysql Backslash escapes (enabled by default) (#844) 2023-04-10 09:56:01 -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
Nick Randall
784a19138f
Support "UPDATE" statement in "WITH" subquery (#842)
* fix(WITH): allow "UPDATE" statement in "WITH" subquery"

* add test case

* update test to validate round-trip
2023-04-09 07:41:56 -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
pawel.leszczynski
79c7ac73df
support CREATE/DROP STAGE for Snowflake (#833)
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
2023-03-26 07:31:37 -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
Felix Yan
eb67d489bb
Correct typos in parser.rs (#838) 2023-03-18 11:23:18 -04:00
sam
a8a8e65b7c
PostgreSQL: GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY and GENERATED ALWAYS AS ( generation_expr ) support (#832)
* GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) basic impl - test are failing.

* PostgreSQL GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) and GENERATED ALWAYS AS ( generation_expr ) STORED implementation.
2023-03-16 05:54:00 -04:00
pawel.leszczynski
4ff3aeb040
support IF EXISTS in COMMENT statements (#831)
* support IF EXISTS in COMMENT statements

Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>

* Update src/ast/mod.rs

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

---------

Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-03-09 08:06:39 -05:00
pawel.leszczynski
548191814c
support snowflake alter table swap with (#825)
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
2023-03-07 07:16:39 -05:00
Andrew Lamb
9ea396d0da
Improve documentation on verified_* methods (#828) 2023-03-07 07:07:29 -05:00
Andrew Lamb
5f815c2b08 (cargo-release) version 0.32.0 2023-03-06 11:58:23 -05:00
Andrew Lamb
1d358592ab
Changelog for 0.32.0 (#830) 2023-03-06 11:57:27 -05: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
Ankur Goyal
d69b875367
ClickHouse CREATE TABLE Fixes: add ORDER BY and fix clause ordering (#824)
* Fix ClickHouse (add ORDER BY)

* Improve test case
2023-03-06 09:55:55 -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
Ankur Goyal
b45306819c
Add support for trailing commas (#810)
* Add support for trailing commas

* Support trailing commas for brace/bracket

* Andrew's comments
2023-03-02 10:35:46 -05:00
Y Togami
2285bb44ba
chore: fix typo (#822) 2023-03-02 10:32:20 -05:00
Andrew Lamb
b838415276 (cargo-release) version 0.31.0 2023-03-01 14:25:38 -05:00
Andrew Lamb
66ec634c67
Update CHANGELOG for version 0.31 (#820) 2023-03-01 14:23:15 -05:00
Y Togami
58de3c1222
feat: support raw string literal of BigQuery (#812)
* add tests

* feat: parse raw literal of bq

* merge double quoted & single quoted to raw string literal

* Update src/ast/value.rs

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-03-01 14:11:42 -05:00
Y Togami
70917a59ed
feat: SELECT * REPLACE <Expr> AS <Identifier> for bigquery (#798)
* chore: add test for wildcard replace

* feat: define opt_replace for wildcard replace

* fix: modify replace option ast

* fix: add test cases

* chore: fmt

* redefine ast

* feat: parse select replace items

* ci

* Update src/ast/query.rs

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-03-01 13:52:25 -05:00
Y Togami
0c0d088ec2
feat: support byte string literal in bq (#802)
* rebase

* review

* lint
2023-02-19 10:38:03 -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
Maciej Obuchowski
a2fea10f89
snowflake: add support for TRANSIENT keyword (#807)
* snowflake: add support for TRANSIENT keyword

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

* fix clippy

---------

Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-02-17 13:55:56 -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
Maciej Skrzypkowski
488e8a8156
Support MySQL Character Set Introducers (#788)
* MySQL Character Set Introducers

* Documentation fix

* Parsing string introducer from Token::word

* Fixed lint

* fix clippy

---------

Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-02-17 13:38:43 -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
Ziinc
4955863bdf
fix: handle bigquery offset in map key (#797)
* fix: handle bigquery offset in map key

* chore: add in more comments and tests

* chore: fix all linting and compilation warnings
2023-01-21 12:05:59 -05:00
SARDONYX
ca939413f2
fix(Dialect): fix a typo (precendence -> precedence) (#794)
* fix(Dialect): fix a typo

* fix: fix a typo in tests
2023-01-15 05:31:49 -05:00
Ophir LOJKINE
3f874f4ab8
use post_* visitors for mutable visits (#789)
My initial implementation of mutable visitors closely matched the existing immutable visitor implementations,
and used pre_* visitors (a mutable expression was first passed the visitor, then its children were visited).

After some initial usage, I realize this actually impractical, and can easily lead to infinite recursion when one isn't careful.
For instance a mutable visitor would replace x by f(x),
then would be called again on the nested x and result in f(f(x)),
then again resulting in f(f(f(x))), and so on.

So, this commit changes the behavior of the visit_*_mut functions to call the visitor on an expression only
once all of its children have been visited.

It also makes the documentation more explicit and adds an example.
2023-01-09 17:04:00 -05:00