Tag Archives: SQL

PostgreSQL: generate_series

If you want to dummy up a bunch of data in PostgreSQL you can use this neat little trick create table test (a int); insert into test (select generate_series(0,999,1)); INSERT 0 1000

HowTo: Add Single Quotes to results in dynamic SQL

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 [...]