zvonimir-dd commented on code in PR #2627:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2627#discussion_r4283461460
##########
src/ast/mod.rs:
##########
@@ -6913,8 +6913,17 @@ pub struct OnConflict {
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
/// Target specification for an `ON CONFLICT` clause.
pub enum ConflictTarget {
- /// Target specified as a list of columns.
- Columns(Vec<Ident>),
+ /// Target specified as a list of columns, optionally followed by
PostgreSQL's
+ /// `WHERE index_predicate`, which lets a partial unique index be inferred
as the arbiter:
+ /// `ON CONFLICT (a) WHERE b > 0 DO ...`.
+ ///
+ /// See <https://www.postgresql.org/docs/current/sql-insert.html>
Review Comment:
Thanks, applied your suggestion as written in 8936117e. I also added
`parse_on_conflict_target_predicate` to `tests/sqlparser_sqlite.rs`, so
restricting the parse to PostgreSQL would fail a test rather than only
contradict the doc.
I checked it against SQLite 3.37.2 as well. With a partial unique index on
`t (a) WHERE b > 0`, `INSERT INTO t VALUES (1, 2, 3) ON CONFLICT (a) WHERE b >
0 DO NOTHING` runs, and the second insert is a no-op. `ON CONFLICT WHERE b > 0`
is a syntax error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]