This is rather estetic not real issue. In my opinion escape characters ($$) shouldn't be copied to routine body field. For example:
$$
SELECT (lpad(year::text, 4, '0'::text) || 'W'::text) || lpad(week::text, 2, '0'::text) AS yearweek
$$
Please login to leave a reply, or register at first.