问题描述
我正在尝试使用hasura API将计算字段添加到架构“ abc”中的graphql表“ user”中,但收到以下错误:
Saving computed field Failed
in table "abc.user": in computed field "full_name": the computed field "full_name"
cannot be added to table "abc.user" because the function "abc.fullname" is
of type VOLATILE; cannot be added as a computed field
CREATE OR REPLACE FUNCTION abc.fullname(userrow abc.user)
RETURNS TEXT AS $$
BEGIN
SELECT userrow.first_name || ' ' || userrow.last_name;
END;
$$ LANGUAGE plpgsql;
我能够从下拉列表中选择函数“全名”,但是在添加计算字段时出现错误。任何指导表示赞赏。谢谢。
解决方法
该错误消息试图告诉您。您需要将函数显式声明为Size of X is 3
Size of Y is 5
Goes into X[0] -> Fill that element with the 5 inputs 0 * y[0],then 0 * y[1]... etc
Goes to X[1] -> Fills it with the 5 inputs of 1 * Y[0],then 1 * Y[1] ..
goes into X[2] -> same thing as before
,以便可以在计算列的定义中使用它:
immutable