процедура моя
CREATE OR REPLACE FUNCTION auto_increment_version(id bigint)
RETURNS bigint
LANGUAGE plpgsql
AS $$
DECLARE
res BIGINT;
BEGIN
SELECT COUNT(*)
INTO res
FROM appsellschema."product-version"
WHERE template_id = id;
RETURN res+1;
END;
$$;
SELECT appsellschema.auto_increment_version(1);
В консоль ошибка
[2018-02-01 12:50:40] [42702] ERROR: column reference "id" is ambiguous
[2018-02-01 12:50:40] Подробности: It could refer to either a PL/pgSQL variable or a table column.
[2018-02-01 12:50:40] Где: PL/pgSQL function appsellschema.auto_increment_version(bigint) line 6 at SQL statement
[2018-02-01 12:50:40] Summary: 1 of 1 statements executed, 1 failed in 33ms (46 symbols in file)
Куда копать?