* Fix table alias parsing regression
* Revert "Support redshift's columns definition list for system information functions (#769)"
This reverts commit c35dcc93a7.
* 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>
* 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>
* Support parse json in snowflake
* MR Review
* Lint
* Try to fix right as value
* Fix tests
* Fix lint
* Add generic dialect
* Add support in key location
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.