我在之前post发布的参考解决方案导致了另一种情况。 尝试插入目标表时(如下所示)。
-- Table: normalized_transaction
-- DROP TABLE normalized_transaction;
CREATE TABLE normalized_transaction
(
transaction_id uuid,
file_id uuid,
account_number character varying(40),
currency character varying(3),
trade_date date,
value_date date,
narration character varying(200),
amount numeric,
mesitis_account_number character varying(50),
tag character varying(255),
supporting_file_id uuid,
supporting_record_id uuid,
status integer DEFAULT 0,
source_type integer,
record_index integer DEFAULT 0
)
使用像
这样的查询INSERT INTO normalized_transaction(account_number, currency, trade_date)
select gen_Test('english');
fetch all in english;
导致错误:
ERROR: INSERT has more target columns than expressions
LINE 2: ...NSERT INTO normalized_transaction(account_number, currency, ...
^
********** Error **********
ERROR: INSERT has more target columns than expressions
SQL state: 42601
Character: 53
select gen_Test('english');
fetch all in english;
Just for Reference Output of above Query:
将结果从此处插入表中的适当方法是什么。
答案 0 :(得分:0)
你可以尝试这样:
INSERT INTO normalized_transaction(account_number, currency, trade_date)
SELECT foo.*
FROM gen_Test('english') as foo;