* 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>
* 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
* 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>
* 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
* support ceil/floor to datetime
* Update mod.rs
* Update parser.rs
* murphys law
* Update sqlparser_common.rs
* possible fix?
* remove question mark
* ceil to floor
* Update mod.rs
* Apply suggestions from code review
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* refactor into parse_ceil_floor_expr
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* Generalize EscapeSingleQuoteString to arbitrary quote character
* Fix escaping of trailing quote in quoted identifiers
* Add new tests instead of modifying existing tests
Fixes#168 by enabling `DATE` and other keywords to be used as
identifiers when not followed by a string literal.
A "typed string" is our term for generalized version of `DATE '...'`/`TIME '...'`/
`TIMESTAMP '...'` literals, represented as `TypedString { data_type, value }`
in the AST.
Unlike DATE/TIME/TIMESTAMP literals, this is a non-standard extension
supported by PostgreSQL at least.
This is a port of MaterializeInc/materialize#3146
Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
Co-authored-by: Nickolay Ponomarev <asqueella@gmail.com>
Alter INTERVAL to support postgres syntax
This patch updates our INTERVAL implementation such that the Postgres
and Redshfit variation of the syntax is supported: namely that 'leading
field' is optional.
Fixes#177.
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.