Merge fails with "syntax error" when a table's CHECK uses a jsonb operator and either side changed the schema
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Reproduce with the setup SQL in the issue against doltgresql: create the table with the jsonb CHECK, branch to src and dst, change the schema on src, change data on dst, then run dolt_merge. Find where the syntax error is raised during the merge, since the same history without a CHECK succeeds. Done when the merge completes for the ->>, -> and ? cases and the @> refusal is addressed or split out.
由索引模型根据 Issue 内容生成。
描述
Doltgres version: 1.5.1
Setup:
CREATE TABLE objects (
id text PRIMARY KEY,
project_id text NOT NULL,
body jsonb NOT NULL,
CHECK (body->>'left' <> 'forbidden')
);
INSERT INTO objects VALUES ('r1', 'p1', '{"left": "a"}');
SELECT dolt_commit('-Am', 'base');
SELECT dolt_branch('dst');
SELECT dolt_branch('src');
On src, change the schema:
-- connected to src
ALTER TABLE objects ADD COLUMN extra text;
UPDATE objects SET extra = 'x' WHERE id = 'r1';
SELECT dolt_commit('-Am', 'add column');
On dst, change any data:
-- connected to dst
UPDATE objects SET project_id = 'p2' WHERE id = 'r1';
SELECT dolt_commit('-Am', 'edit');
SELECT dolt_merge('src');
Expected: the merge succeeds, because the two changes do not conflict.
Actual: ERROR: syntax error at position 18 near 'body' (SQLSTATE XX000). Nothing is merged.
Observations:
- The
->operator fails the same way. With?(CHECK (body ? 'left')), the message issyntax error at position 16 near ':v1'. - It also fails when the source drops a column, when the source adds the CHECK itself, and when only the destination added a column while the source changed data.
- These succeed: the same history with no CHECK, a function-form CHECK (
CHECK (jsonb_typeof(body) = 'object')), data-only changes on both sides, and a merge into a destination with no change since the merge base. - Separately, a CHECK using
@>cannot hold a row: the first INSERT fails withJSON contains is not yet supported. - The same refusal occurs inside an explicit transaction (
BEGINbeforedolt_merge), so it does not depend on autocommit.
- 主要语言
- Go
- 星标
- 2.2k
- 派生
- 93
- 平均合并
- 19 小时 38 分钟
- 30 天内合并 PR
- 132
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dolthub/doltgresql 的其他 Issue
-
customer issue
难度 2/5 1-3 小时 新手友好度 62/100
dolthub/doltgresql#3969 ·
维护者通常 1 天内回复
-
`CREATE TABLE ... TABLESPACE pg_default` fails: TABLESPACE is not yet supported可能已有人在做 @draarivpatel-ui 于 1 天前认领。 未关闭customer issue
难度 2/5 1-3 小时 新手友好度 68/100
dolthub/doltgresql#3818 ·
维护者通常 1 天内回复
-
customer issue
难度 2/5 1-3 小时 新手友好度 67/100
dolthub/doltgresql#3817 ·
维护者通常 1 天内回复
-
customer issue
难度 4/5 3-5 天 新手友好度 25/100
dolthub/doltgresql#3980 ·
维护者通常 1 天内回复
-
customer issue
难度 4/5 3-5 天 新手友好度 42/100
dolthub/doltgresql#3978 ·
维护者通常 1 天内回复
查看 dolthub/doltgresql 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
documentation factory:ready
难度 2/5 1-3 小时 新手友好度 72/100
-
good first issue spec
难度 2/5 1-3 小时 新手友好度 66/100
-
docs
难度 2/5 1-3 小时 新手友好度 66/100
open-telemetry/opentelemetry.io#12846 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复