* 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>
* 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>
* 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>
* 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>
* Inital support in current_timestamp
* Support time functions
* Add Test
* Fix PR
* Fix tests
* Add Support for distinct with parentheses
* Fix nightly
* 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
* 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>
* * 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>
* 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>
* 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>
* Support TRIM syntax
- Implement the following cases
- TRIM([BOTH | LEADING | TRAILING] <expr> [FROM <expr>])
- TRIM(<expr>)
* Resolve 1.54.0 clippy error
- Remove needless borrow
* Add test cases for TRIM
Snowflake diverges from the standard and from most of the other
implementations by allowing extra parentheses not only around a join,
but around lone table names (e.g. `FROM (mytable [AS alias])`) and
around derived tables (e.g. `FROM ((SELECT ...) [AS alias])`) as well.
Initially this was implemented in https://github.com/ballista-compute/sqlparser-rs/issues/154
by (ab)using `TableFactor::NestedJoin` to represent anything nested in
extra set of parens.
Afterwards we learned in https://github.com/ballista-compute/sqlparser-rs/issues/223
that in cases of such extraneous nesting Snowflake allows specifying the
alias both inside and outside parens, but not both - consider:
FROM (table_factor AS inner_alias) AS outer_alias
We've considered implementing this by changing `TableFactor::NestedJoin`
to a `TableFactor::Nested { inner: TableWithJoins, alias:
Option<TableAlias> }`, but that seemed too generic, as no known dialect
supports duplicate aliases, as shown above, nor naming nested joins
`(foo NATURAL JOIN bar) alias`. So we decided on making a smaller change
(with no modifications to the AST), that is also more appropriate to the
contributors to the Snowflake dialect:
1) Revert #154 by rejecting `FROM (table or derived table)` in most dialects.
2) For `dialect_of!(self is SnowflakeDialect | GenericDialect)` parse
and strip the extraneous parentheses, e.g.
`(mytable) AS alias` -> `(mytable AS alias)`
Co-authored-by: Eyal Leshem <eyal@satoricyber.com>
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.