PostgreSQL防止验证类型名称为password时的空password行



我有两个表在PostgreSQL

authentication_type

<表类> id 名称 created_at updated_at tbody><<tr>c1cc0489 - 4740 - 4 - dca - 9 - d63 - 14 - e4c26093ad密码……

你把布尔逻辑搞错了。您需要以下其中一个(或两个):

  • type_id不是"password-id">
  • 密码不为空
CHECK CONSTRAINT (
authentication_type_id != 'c1cc0489-4740-4dca-9d63-14e4c26093ad'
OR
password IS NOT NULL
)

相关内容

最新更新