apache / apache/datafusion-sqlparser-rs

Can't parse jsonb extractions in an on conflict in Postgres

未关闭
#1,977 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
3.5k
派生
772
平均合并
4 天 9 小时
30 天内合并 PR
17

描述

The parser does not support the following:

```sql
INSERT INTO table_with_constraint_over_jsonb (a_number, a_jsonb, a_string)
VALUES ($1, $2, $3)
ON CONFLICT (a_number, (a_jsonb->>'name'))
DO UPDATE SET a_string = EXCLUDED.a_string
RETURNING *;
```

It errors on the `(a_jsonb->>'name')` part with the error: `ParserError("Expected: identifier, found: ( at Line: 1, Column: 119")`.

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先,使用 issue 中的 SQL 语句重现 parser 错误,重点关注 ON CONFLICT target 中带括号的 jsonb 提取。跟踪 SQL parser 对 ON CONFLICT 表达式的处理,然后验证该语句能够成功解析,且不会使其他 conflict target 发生回归。

由索引模型根据 Issue 内容生成。

评估

技术栈
postgres, rust, sql
领域
compilers, databases
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。