首页 > 解决方案 > 如何删除行名称带有“。”的行

问题描述

我有这张桌子:

 id |            key            |                value                 
----+---------------------------+--------------------------------------
  1 | insight.enabled           | true
  3 | customer_id               | 2720f38b-c999-4f29-ba32-4da851c58d06
  4 | eula_accepted             | true
  5 | insight.mandatory_confirm | true
  6 | automation.enabled        | true
  7 | automation.enabled        | false
  8 | automation.enabled        | false

当我执行以下命令时,我想删除 automation.enabled row :

delete from configuration where automation.enabled='false';

我收到以下错误消息:

ERROR:  missing FROM-clause entry for table "automation"
LINE 1: delete from configuration where automation.enabled='false';

我怎样才能逃脱'。作为列名的一部分?

标签: postgresql

解决方案


条件需要一列。automation.enabled是特定行中的值。因此,您需要的是:

DELETE from configuration where key = 'automation.enabled' AND value = 'false';

推荐阅读