为什么我得到 Insert has more target columns than expressions
Why I am getting Insert has more target columns than expressions
我有一个名为 source 的简单 table,其中包含 3 列(source_id、名称、tenant_id)和一些数据。
我试图通过检查 table 中是否存在数据来将数据插入 table。但是我收到这个错误..知道如何解决
查询 -
INSERT INTO moa.source(source_id, name, tenant_id)
SELECT ((select max(source_id)+1 from moa.source), 'GE OWS - LHR', 1)
WHERE NOT EXISTS(SELECT 1 FROM moa.source where name = 'GE OWS - LHR');
错误:
ERROR: INSERT has more target columns than expressions
LINE 1: INSERT INTO moa.source(source_id, name, tenant_id)
^
HINT: The insertion source is a row expression containing the same number of columns expected by the INSERT. Did you accidentally use extra parentheses?
SQL state: 42
Table:
抱歉..我知道了..Select
后应该没有括号
我有一个名为 source 的简单 table,其中包含 3 列(source_id、名称、tenant_id)和一些数据。 我试图通过检查 table 中是否存在数据来将数据插入 table。但是我收到这个错误..知道如何解决
查询 -
INSERT INTO moa.source(source_id, name, tenant_id)
SELECT ((select max(source_id)+1 from moa.source), 'GE OWS - LHR', 1)
WHERE NOT EXISTS(SELECT 1 FROM moa.source where name = 'GE OWS - LHR');
错误:
ERROR: INSERT has more target columns than expressions
LINE 1: INSERT INTO moa.source(source_id, name, tenant_id)
^
HINT: The insertion source is a row expression containing the same number of columns expected by the INSERT. Did you accidentally use extra parentheses?
SQL state: 42
Table:
抱歉..我知道了..Select
后应该没有括号