PostgreSQL - Advanced PL/pgSQL
What is wrong with this dynamic SQL usage?
DECLARE
col text := 'price';
total numeric;
BEGIN
EXECUTE format('SELECT sum(%L) FROM sales', col) INTO total;
RAISE NOTICE 'Total: %', total;
END;