我正在尝试构建一个满足以下条件的简单函数(需要使用 Hasura API fwiw链接)
Function behaviour: ONLY STABLE or IMMUTABLE
Return type: MUST be SETOF <table-name>
Argument modes: ONLY IN
这是功能
CREATE FUNCTION fn_sum_views(text) RETURNS SETOF page_analytics AS $$
SELECT prodID, sum(views) FROM page_analytics WHERE prodID = $1 group by prodID
$$ LANGUAGE SQL STABLE;
我得到错误:"column \"prodid\" does not exist"
。当我使用page_analytics.prodID
, "page_analytics.prodID"
, 或\"page_analytics.prodID\"