How to pass a table name and column name as params? Answered by LLM :
CREATE OR REPLACE FUNCTION increment(x int, row_id int, table_name text, column_name text)
RETURNS void AS
$$
BEGIN
EXECUTE format('UPDATE %I SET %I = %I + $1 WHERE id = $2',
table_name, column_name, column_name)
USING x, row_id;
END;
$$
LANGUAGE plpgsql VOLATILE;