haveInDatabase() is not usable inside a transaction on PostgreSQL
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 42/100
调研方向
从 haveInDatabase() 入口点开始,在事务中使用 PostgreSQL 时跟踪 lastInsertId() 调用。使用名称不同于 PostgreSQL 生成名称的主键序列复现该情况,然后验证数据库语句是否成功执行而不会静默中止事务,并且后续语句不会失败。
由索引模型根据 Issue 内容生成。
描述
Our tables have PK sequences with different names than the ones postgres generates automatically. Because of that the lastInsertId() call inside haveInDatabase() generates a silent error.
When you use the method in a transaction, you don't see the actual error but the transaction is marked as "aborted" and you get exception and test fail on the next db statement. Without a transaction the test works fine but leaves other residues, which I hoped to clear by rollback. It took some time to debug and find the actual cause.
I did not find any warning about such limitation or previous mentions of it.
As a workaround I used INSERT .. RETURNING.
- 主要语言
- PHP
- 星标
- 23
- 派生
- 31
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeception/module-db 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
Codeception/module-db#85 ·
-
Make optional the auto-erase of the records, added by `haveInDatabase()`可能已有人在做 @iliayatsenko 于 723 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-db#68 · 1 条评论 ·
-
Fix a confusion between 'cleanup' and 'skip_cleanup_if_failed' configuration params可能已有人在做 @iliayatsenko 于 723 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-db#67 ·
-
inserting null on an autoincrement primary key prevents cleanup可能已有人在做 @jtopenpetition 于 1261 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 38/100
Codeception/module-db#58 ·
-
难度 3/5 1-2 天 新手友好度 45/100
Codeception/module-db#54 ·
查看 Codeception/module-db 的全部 Issue
相似的 Issue
-
sync-en
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
forms ui
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
taskforcesh/bullmq#5238 ·
维护者通常 1 天内回复
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects it可能已有人在做 @bfs2021 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复