Phil> execute ''column_values :=
Phil> column_values || quote_literal(r.'' || cr.column_name || '')'';
basic> FOR rec IN EXECUTE
basic> ''select column_values || quote_literal(r.'' ||
basic> cr.column_name || '') alias column_values''; LOOP
basic> column_values := rec.column_values;
basic> END LOOP;
I think your code will try to execute a query like this:
select column_values || quote_literal(r.something) alias column_values
This will fail because column_values and r are both plpgsql variables, and so are not visible to the SQL interpreter.
Any other suggestions?
--Phil.