mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-08 01:15:00 +00:00
feat: Support PostgreSQL exponentiation. (#813)
* Add Postgres exponent operator * Parse caret as BinaryOperator::PGExp in PostgreSQL * Update sqlparser_postgres.rs * update tests to support PGExp * cargo fmt * improve extensibility * cargo fmt * redundant code and documentation lionks
This commit is contained in:
parent
fbbf1a4e84
commit
1cf913e717
4 changed files with 32 additions and 10 deletions
|
@ -1322,15 +1322,16 @@ fn parse_pg_returning() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn parse_pg_bitwise_binary_ops() {
|
||||
let bitwise_ops = &[
|
||||
// Sharp char cannot be used with Generic Dialect, it conflicts with identifiers
|
||||
fn parse_pg_binary_ops() {
|
||||
let binary_ops = &[
|
||||
// Sharp char and Caret cannot be used with Generic Dialect, it conflicts with identifiers
|
||||
("#", BinaryOperator::PGBitwiseXor, pg()),
|
||||
("^", BinaryOperator::PGExp, pg()),
|
||||
(">>", BinaryOperator::PGBitwiseShiftRight, pg_and_generic()),
|
||||
("<<", BinaryOperator::PGBitwiseShiftLeft, pg_and_generic()),
|
||||
];
|
||||
|
||||
for (str_op, op, dialects) in bitwise_ops {
|
||||
for (str_op, op, dialects) in binary_ops {
|
||||
let select = dialects.verified_only_select(&format!("SELECT a {} b", &str_op));
|
||||
assert_eq!(
|
||||
SelectItem::UnnamedExpr(Expr::BinaryOp {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue