What error POSTGRESQL procedure?

my procedure
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);

In the console error
[2018-02-01 12:50:40] [42702] ERROR: column reference "id" is ambiguous
[2018-02-01 12:50:40] Detail: It could refer to either a PL/pgSQL variable or a table column.
[2018-02-01 12:50:40] Where: 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)

Where to dig?
June 8th 19 at 16:54
1 answer
June 8th 19 at 16:56
Solution
The cause of the error hranilki fully and accurately indicated in the detail text of the error:
It could refer to either a PL/pgSQL variable or a table column.

You have in the table is the id field, hranilki the id argument - which one means the parser doesn't understand.

Find more questions by tags PostgreSQL