* add support for postgres composite types
Signed-off-by: password <rbalajis25@gmail.com>
* fix composite test for bigdecimal feature
Signed-off-by: password <rbalajis25@gmail.com>
* Redshift square bracket handling
We need to detect `[` or `"` for Redshift quotes around indentifier and at the same time exclude
treating JSON paths as indentifer
* RedshiftSqlDialect documentation update
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* Renamed _chars to chars
* Fixed warnings
* Missing license
Co-authored-by: Maciej Skrzypkowski <maciej.skrzypkowski@satoricyber.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* implement parsing COPY statement
* support COPY option syntax before PostgreSQL version 9.0
Signed-off-by: Runji Wang <wangrunji0408@163.com>
* update COPY tests
Signed-off-by: Runji Wang <wangrunji0408@163.com>
* improve docs for COPY
Signed-off-by: Runji Wang <wangrunji0408@163.com>
* test and fix AS in COPY
Signed-off-by: Runji Wang <wangrunji0408@163.com>
* recover original test cases
* fix cargo clippy
* fix: Handle double quotes inside quoted identifiers correctly
This fixes#410 for standard SQL, however I don't know enough about other dialects to know if they
handle this differently. May need more extensive testing as well.
* refactor: Make quoted identifier parsing a seperate function
* test: Check that quoted identifier tokenization works
Added `pretty_assertions` so that the `assert_eq!` in the tokenization is readable
* test: Check that quoted identifiers work in mysql
* chore: cargo clippy
* 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>
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.
The Ident type was previously an alias for a String. Turn it into a full
fledged struct, so that the parser can preserve the distinction between
identifier value and quote style already made by the tokenizer's Word
structure.
The SQL standard requires that numeric literals with a decimal point,
like 1.23, are represented exactly, up to some precision. That means
that parsing these literals into f64s is invalid, as it is impossible
to represent many decimal numbers exactly in binary floating point (for
example, 0.3).
This commit parses all numeric literals into a new `Value` variant
`Number(String)`, removing the old `Long(u64)` and `Double(f64)`
variants. This is slightly less convenient for downstream consumers, but
far more flexible, as numbers that do not fit into a u64 and f64 are now
representable.
The rationale here is the same as the last commit: since this crate
exclusively parses SQL, there's no need to restate that in every type
name. (The prefix seems to be an artifact of this crate's history as a
submodule of Datafusion, where it was useful to explicitly call out
which types were related to SQL parsing.)
This commit has the additional benefit of making all type names
consistent; over type we'd added some types which were not prefixed with
"SQL".
The ASTNode enum was confusingly named. In the past, the name made
sense, as the enum contained nearly all of the nodes in the AST, but
over time, pieces have been split into different structs, like
SQLStatement and SQLQuery. The ASTNode enum now contains only contains
expression nodes, so Expr is a better name.
Also rename the UnnamedExpression and ExpressionWithAlias variants
of SQLSelectItem to UnnamedExpr and ExprWithAlias, respectively, to
match the new shorthand for the word "expression".
Standardize the license header, removing the Grove Enterprise copyright
notice where it exists per #58. Also add a CI check to ensure that files
without license headers don't get merged.
Fix#58.