I frequently find the need to have single quoted output when i generate dynamic SQL.
It’s always a pain to remember the exact number of ticks needed to get the quoted output.
Here is a reminder on how to do it:
select ''''||schemaname||'.'||tablename||'''' from pg_tables
4 quotes when there’s no text, or 3 quotes on the outside and one on the inside when there is text.
select '''public.'||tablename||'''' from pg_tables
0 Comments.