0
我想在PostgreSQL創建一個用戶定義的函數:無法創建一個簡單的PostgreSQL函數
CREATE FUNCTION get_balance(user_id integer, statuses integer[]) RETURNS INTEGER
AS $$
select SUM(table1.credit)
from table1
inner join table2
on table2.field1 = table1.id
inner join table3
on table3.field1 = table2.id
where table3.status_id in (statuses); $$
LANGUAGE SQL;
的錯誤是:
ERROR: operator does not exist: integer = integer[]
LINE 11: where table3.status_id in (statuses); $$
我在做什麼錯?