postgresql - 为什么我不能在具有默认值的 notNull 列中插入空值?
问题描述
我使用 liquibase yml 在表中添加了一个新列:
databaseChangeLog:
- changeSet:
id: pay-process-add-column
author: m.rybalkin
changes:
- addColumn:
tableName: pay_process
columns:
- column:
name: deferred_pay_notification
type: boolean
defaultValue: false
constraints:
nullable: false
但是当我尝试deferred_pay_notification = null
在表中插入一个新行时,我收到了一个错误:
Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "deferred_pay_notification" violates not-null constraint
可以修复吗?
解决方案
推荐阅读
- .net - 链接已被 CORS 策略阻止:没有“访问控制允许来源”
- c++ - 如何从两个不同的双向链表中更改两个不同的节点?
- javascript - Linux 和 MacOS 上的 Webpack 开发服务器热重载,但 Windows 上没有?
- python - 为什么启动 Numba cuda 内核最多可使用 640 个线程,但在有大量可用 GPU 内存时会因 641 而失败?
- react-native - 如何在从我的反应本机应用程序共享/发布文本到 Facebook 时避免“登录”
- python - 计算熊猫中的数组
- directus - 使用 SQL 插入图像
- dask - 在雪花中使用时间戳索引时出错
- python - TensorFlow 在导入期间失败:“ImportError: cannot import name 'mirrored_strategy_with_two_gpus_no_merge_call'”
- animation - 如何从 react-beautiful-dnd 中删除拖动开始动画?