我正在尝试使用 hasura API 在模式“abc”中将计算字段添加到我的 graphql 表“用户”,但收到以下错误:
**Saving computed field failed**
in table "abc.user": in computed field "allaccounts": function "abc.get_accounts"
is overloaded. Overloaded functions are not supported
该功能已正确添加:
CREATE OR REPLACE FUNCTION abc.get_accounts(id bigint)
RETURNS VARCHAR immutable AS $$
DECLARE
value VARCHAR;
BEGIN
SELECT array_to_string(ARRAY_AGG( name ORDER BY name ASC )::varchar[], ',', '')
into value
FROM abc.account
INNER JOIN abc.user_account ON (account.id=user_account.account_id)
where user_account.user_id = id group by user_id;
return value;
END;
$$ LANGUAGE plpgsql;
id 字段存在于用户表中。
我可以从下拉列表中选择函数“get_accounts”,但在添加计算字段时出现错误。任何指导表示赞赏。谢谢你。