Commit graph

1171 commits

Author SHA1 Message Date
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
Justin Joyce
82cf554394
Add User (#787) 2023-01-09 17:00:55 -05:00
Andrew Lamb
260a012f8c (cargo-release) version 0.30.0 2023-01-02 10:47:00 -05:00
Andrew Lamb
d0ef564fa1
Changelog for 0.30.0 (#786) 2023-01-02 10:46:27 -05:00
Andrew Lamb
204bdc5b62
Fix logical conflict (#785) 2023-01-02 10:40:42 -05:00
Jeffrey
17f604f757
Support RENAME for wildcard SELECTs (#784) 2023-01-02 10:29:06 -05:00
Jeffrey
98403c07b1
Allow parsing of mysql empty row inserts (#783) 2023-01-02 06:51:13 -05:00
Ophir LOJKINE
524b8a7e7b
Add a mutable visitor (#782)
* Add a mutable visitor

This adds the ability to mutate parsed sql queries.
Previously, only visitors taking an immutable reference to the visited structures were allowed.

* add utility functions for mutable visits

* bump version numbers
2023-01-02 06:48:20 -05:00
Andrew Lamb
86d71f2109 (cargo-release) version 0.29.0 2022-12-29 08:07:19 -06:00
Andrew Lamb
890062c36d
Changelog for 29.0.0 (#780)
* Changelog for 29.0.0

* updates
2022-12-29 09:06:17 -05:00
Andrew Lamb
87df09be18
Improve docs and add examples for Visitor (#778)
* Improve docs and add examples for Visitor

* Update src/ast/visitor.rs

Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>

* Update src/ast/visitor.rs

Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>

Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>
2022-12-29 08:56:41 -05:00
Andrew Lamb
fc503e08c9
Add a backlink from sqlparse_derive to sqlparser and publishing instructions (#779)
* Add backlink to sqlparser-rs in derive docs

* Update release docs for sqlparser_derive
2022-12-29 07:55:42 -05:00
Jeffrey
cf3fe64af6
ParserError if nested explain (#781) 2022-12-29 07:55:10 -05:00
Andrew Lamb
b93d82dfca
Fix cargo docs / warnings and add CI check (#777)
* Fix all rustdoc links

* Add docs CI check

* workflow

* test error

* fix yml

* fix yml

* Revert "test error"

This reverts commit 96a40a88a3.

* fix

* more
2022-12-29 07:53:51 -05:00
Alex Vasilev
072ccc0d76
feat: dollar-quoted strings support (#772)
* feat: support dollar-quoted strings

* remove comment

* unused code

* removed debugging

* added tests

* fmt

* clippy

* updated tests
2022-12-29 07:52:17 -05:00
Andrew Lamb
0c9ec40082
Document new features, update authors (#776) 2022-12-28 11:13:25 -05:00
Andrew Lamb
751046de7d
Improve Readme (#774) 2022-12-28 10:49:51 -05:00
Raphael Taylor-Davies
dec3c2b818
Add derive based AST visitor (#765)
* Add derive based AST visitor

* Fix BigDecimal

* Fix no visitor feature

* Add test

* Rename visit_table to visit_relation

* Review feedback

* Add pre and post visit

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-12-28 10:07:12 -05:00
김진성 Kim Jinsung
3e990466f8
Support CREATE TABLE ON UPDATE <expr> Function (#685)
* feat : OnUpdate Function Implement

* feat : add GenericDialect Options
2022-12-28 08:59:09 -05:00
Andrew Lamb
b1a000f149
Standardize comments on parsing optional keywords (#773) 2022-12-28 08:52:12 -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
zidaye
2d801c9fb6
Support DROP FUNCTION syntax (#752)
* drop function

* update  and  to Option

* fix review

* update

* fmt
2022-12-28 07:57:51 -05:00
Audun Skaugen
3d5cc54dcf
Generalize conflict target (#762)
Postgres supports `ON CONFLICT ON CONSTRAINT <constraint_name>` to
explicitly name the constraint that fails. Support this.
2022-12-17 07:38:57 -05:00
Audun Skaugen
6d6eb4bc9b
Support json operators @> <@ #- @? and @@
postgres supports a bunch more json operators. See
https://www.postgresql.org/docs/15/functions-json.html

Skipping operators starting with a question mark for now, since those
are hard to distinguish from placeholders without more context.
2022-12-14 14:54:56 -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
zidaye
6c545195e1
support create function definition with $$ (#755)
* support create function definition using '2700775'

* fix warn
2022-12-13 17:15:33 -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
Andrew Lamb
650c53dc77
Add negative test for except clause on wildcards (#746) 2022-12-07 12:19:43 -05:00
yuval-illumex
01fd20f0a3
Support the type key (#750) 2022-12-06 16:07:53 -05:00
Wei-Ting Kuo
bda8268e56
add keyword NANOSECOND (#749) 2022-12-06 15:29:41 -05:00
Ankur Goyal
813f4a2eff
Introduce location tracking in the tokenizer and parser (#710)
* Add locations

* Add PartialEq

* Add PartialEq

* Add some tests

* Fix rebase conflicts

* Fix clippy

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-12-05 14:47:42 -05:00
Andrew Lamb
512a159f08 (cargo-release) version 0.28.0 2022-12-05 14:26:15 -05:00
Andrew Lamb
84291088d9
CHANGELOG.md for 0.28.0 (#747) 2022-12-05 14:21:06 -05:00
Augusto Fotino
b3688513eb
feat: add support for except clause on wildcards (#745) 2022-12-05 14:03:59 -05:00
Runji Wang
5b53df97c4
Support postgres CREATE FUNCTION (#722)
* support basic pg CREATE FUNCTION

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

* support function argument

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

* fix display and use verify in test

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

* support OR REPLACE

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

* fix compile error in bigdecimal

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

* unify all `CreateFunctionBody` to a structure

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

Signed-off-by: Runji Wang <wangrunji0408@163.com>
2022-12-01 16:08:49 -05:00