title: redshift - how to use listagg with information_schema.columns table
body: <p>I'm using redshift and would like to create a comma separated list of columns. I'm trying to grab the column names from information schema using <code>listagg</code>:</p>
  
  <pre><code>SELECT  
  listagg(column_name,',') within group (order by ordinal_position) 
  FROM    information_schema.columns
  WHERE   table_schema = 'my_schema'
  AND     table_name = 'my table';
  </code></pre>
  
  <p>I'm getting the following error:</p>
  
  <pre><code>[Amazon](500310) Invalid operation: Function (listagg(text,text)) must be applied on at least one user created tables;
  </code></pre>