Commit graph

40 commits

Author SHA1 Message Date
Ophir LOJKINE
2182f7ea71
Add support for the MATCH and REGEXP binary operators (#1840) 2025-05-09 01:48:23 +02:00
bar sela
62495f2f0d
Mysql: Add support for := operator (#1779) 2025-03-27 22:48:57 +01:00
benrsatori
339239d0c5
Add support for PostgreSQL/Redshift geometric operators (#1723) 2025-02-20 19:50:32 +01:00
Yoav Cohen
17e22f0a60
Add support for the SQL OVERLAPS predicate (#1638) 2025-01-06 16:35:24 +01:00
wugeer
e857787309
hive: support for special not expression !a and raise error for a! factorial operator (#1472)
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
2024-11-13 01:36:33 -05:00
Andrew Lamb
9934f3d931
Update to ASF header / add when missing (#1437) 2024-09-21 06:23:28 -04:00
Samuel Colvin
a5480ae498
Support Dialect level precedence, update Postgres Dialect to match Postgres (#1360) 2024-08-06 07:49:37 -04:00
Ophir LOJKINE
4b60866bc7
add support for custom operators in postgres (#1302)
Co-authored-by: Joey Hain <joey@sigmacomputing.com>
2024-06-07 07:12:18 -04:00
Andrew Repp
4aa37a46a9
Support ?-based jsonb operators in Postgres (#1242)
Co-authored-by: Andrew Repp <arepp@cloudflare.com>
2024-05-01 06:50:45 -04:00
Joey Hain
4bfa399919
Improve parsing of JSON accesses on Postgres and Snowflake (#1215)
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
2024-04-30 10:49:05 -04:00
Marko Grujic
c7d2903c6d
Add Postgres operators for the LIKE expression variants (#1096) 2024-01-22 14:50:29 -05:00
Alexander Beedie
7cb1654d81
Add support for PostgreSQL ^@ starts-with operator (#1091) 2024-01-15 05:42:03 -05:00
Igor Izvekov
c8b6e7f2c7
feat: comments for all operators (#917) 2023-07-17 14:42:28 -04:00
Igor Izvekov
a50671d95d
feat: support PGOverlap operator (#912) 2023-07-06 09:27:18 -04:00
eitsupi
33b12acce7
feat: add DuckDB dialect (#878)
* feat: add DuckDB dialect

* formatting

* fix conflict

* support // in GenericDialect

* add DucDbDialect to all_dialects

* add comment from suggestion

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

* fix: support // in GenericDialect

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-05-18 14:57:29 -04:00
eitsupi
097e7ad56e
feat: Support MySQL's DIV operator (#876)
* feat: MySQL's DIV operator

* fix: do not use `_` prefix for used variable

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-05-17 13:26:14 -04:00
Maximilian Roos
feaa13c9a9
feat: Add custom operator (#868)
* feat: Add custom operator

From #863

- It doesn't parse anything — I'm not sure how to parse ` SELECT 'a' REGEXP '^[a-d]';` with `REGEXP` as the operator... (but fine for my narrow purpose)
- If we need tests, where would I add them?

* Update src/ast/operator.rs

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2023-05-17 13:12:50 -04:00
Mykhailo Bondarenko
1cf913e717
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
2023-03-02 10:39:39 -05:00
Ophir LOJKINE
524b8a7e7b
Add a mutable visitor (#782)
* 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
2023-01-02 06:48:20 -05:00
Raphael Taylor-Davies
dec3c2b818
Add derive based AST visitor (#765)
* 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>
2022-12-28 10:07:12 -05:00
Augusto Fotino
5e1d9f8d6e
Derive PartialOrd, Ord, and Copy whenever possible (#717)
This allow other projects to use our structures inside others that need
those.
2022-11-30 12:25:59 -05:00
Ayush Dattagupta
f07063f0cd
Support for SIMILAR TO syntax, change Like and ILike to Expr variants, allow escape char for like/ilike (#569)
* Remove [not]like,[not]ilike from binary operator list

* Add like, ilike and similar as an expr variant. Also adds support for escape char to like/ilike

* Add parsing logic for similar to, update parsing logic for like/ilike

* Add tests for similar to, update tests for like/ilike

* Fix linter warnings

* remove additional copyright license from files

* Add more coverage w/wo escape char for like,ilike,similar to
2022-08-11 15:44:26 -04:00
Kaushik Iska
1c64129f76
[postgres] Add support for custom binary operators (#548)
* [postgres] Add support for custom binary operators

More details about operators in general are at:
https://www.postgresql.org/docs/current/sql-createoperator.html. This
patch attempts to parse `SELECT` queries that reference an operator
using `OPERATOR(<optional_schema>.<operator_name>)` syntax.

This is a PostgreSQL extension. There are no provisions for user-defined operators in the SQL standard.

* fix code-review comments and ci failures

* Allow custom operator in generic dialects too

* Parse `OPERATOR` as Vec<String>

* fix: std

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-08-05 13:53:58 -04:00
John
014b82f03d
Add logical xor (#357) 2021-09-18 06:39:35 -04:00
Hoon Wee
5ce67177b3
Fix the term 'Modulus' to 'Modulo' (#335) 2021-08-23 12:05:42 +02:00
Qinxuan Chen
5bc109a7ad
Support no_std (#332)
* Support `no_std`

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix typo

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2021-08-21 10:15:43 +02:00
Andrew Lamb
783bc21d29
Merge pull request #328 from b41sh/regexp_match
Add support for PostgreSQL regex match
2021-08-20 13:54:24 -04:00
Qinxuan Chen
67e17b27f5
Make clippy happy (#330)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2021-08-19 23:02:15 +02:00
b41sh
80759a4deb support regex match 2021-08-13 19:50:14 +08:00
Max Countryman
a9e6f77d62 provide ILIKE support
This introduces support for ILIKE and NOT ILIKE. ILIKE is the
case-insensitive variant of LIKE. Systems such as Postgres, Redshift,
and Snowflake provide this variant.[1][2][3]

[1] https://www.postgresql.org/docs/7.3/functions-matching.html
[2] https://docs.aws.amazon.com/redshift/latest/dg/r_patternmatching_condition_like.html
[3] https://docs.snowflake.com/en/sql-reference/functions/ilike.html
2021-03-22 07:31:42 -07:00
Stephen Carman
8a214f9919
Implement Hive QL Parsing (#235) 2021-02-04 12:53:20 -07:00
Alex Dukhno
926b03a31d
Add parsing for PostgreSQL math operators (#267) 2020-09-30 05:29:31 +03:00
Taehoon Moon
2f1015339a
Add serde support to AST structs and enums (#196)
Apply serde to AST structs and enums to be serializable/deserializable.
serde support is optional, can be activated by feature named "serde".
2020-06-10 12:53:52 +03:00
Daniël Heres
b4699bd4a7
Support bitwise and, or, xor (#181)
Operator precedence is coming from:

https://cloud.google.com/bigquery/docs/reference/standard-sql/operators
2020-06-03 19:02:05 +03:00
Daniël Heres
00dc490f72
Support the string concat operator (#178)
The selected precedence is based on BigQuery documentation, where it is equal to `*` and `/`:

https://cloud.google.com/bigquery/docs/reference/standard-sql/operators
2020-06-02 21:24:30 +03:00
Nickolay Ponomarev
1b31f03732 Change write! to write_str for better rustfmt formatting 2019-07-09 01:38:49 +03:00
Bernardo
b2b159fed1 implement fmt::Display instead of ToString 2019-06-30 17:32:51 +02:00
Jamie Brandon
add898c2bd
Implement Eq alongside Hash
It turns out implementing Hash alone is not very useful, as
std::collection::HashMap keys are required to implement both Hash and
Eq.

Co-authored-by: Nikhil Benesch <nikhil.benesch@gmail.com>
2019-06-25 14:14:28 -04:00
Nikhil Benesch
ac555d7e86
Remove "SQL" prefix from types
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".
2019-06-25 13:11:11 -04:00
Nikhil Benesch
cf655ad1a6
Remove "sql" prefix from module names
Since this crate only deals with SQL parsing, the modules are understood
to refer to SQL and don't need to restate that explicitly.
2019-06-24 12:56:26 -04:00
Renamed from src/sqlast/sql_operator.rs (Browse further)