SELECT *没有指定表无效
我收到此错误:
{
"name": "error",
"length": 189,
"severity": "ERROR",
"code": "42601",
"internalPosition": "8",
"internalQuery": "SELECT *",
"where": "PL/pgSQL function insertintoinstancedlist() line 15 at RETURN",
"file": "parse_target.c",
"line": "1290",
"routine": "ExpandAllTables"
}
而我不能确定是什么导致了它作为我的触发器是一样的另一个另一只不同的表名。这里的触发:
CREATE OR REPLACE FUNCTION
insertIntoInstancedList ()
RETURNS TRIGGER AS $BODY$
DECLARE
BEGIN
INSERT INTO
creator.instanced_lists
(
list_id,
account_id
)
VALUES
(
new._id,
new.account_id
);
RETURN
*;
END
$BODY$
language plpgsql;
CREATE TRIGGER trig_list_insertion
AFTER INSERT ON creator.lists
FOR EACH ROW
EXECUTE PROCEDURE insertIntoInstancedList();
回答如下:
弄清楚了。所需的RETURN
是NEW
。
即
INSERT INTO
creator.instanced_lists
(
list_id,
account_id
)
VALUES
(
new._id,
new.account_id
);
RETURN
NEW; <--- this here