title: convert row to columns redshift
body: <p>I have the following table:</p>
  
  <pre><code> grantor | grantee | table_catalog | table_schema | table_name | privilege_type | is_grantable | with_hierarchy
  
   james   | james   | dev           | test         | rest       | SELECT         | NO           | NO
   james   | james   | dev           | test         | rest       | DELETE         | NO           | NO
   james   | james   | dev           | test         | rest       | INSERT         | NO           | NO
   james   | james   | dev           | test         | rest       | UPDATE         | NO           | NO
   james   | james   | dev           | test         | rest       | REFERENCES     | NO           | NO
   james   | james   | dev           | test         | rest       | RULE           | NO           | NO
   james   | james   | dev           | test         | rest       | TRIGGER        | NO           | NO
   james   | yondo   | dev           | test         | rest       | SELECT         | YES          | NO
   james   | yondo   | dev           | test         | rest       | INSERT         | YES          | NO
  </code></pre>
  
  <p>I want to generate table as: </p>
  
  <pre><code> grantee | table_name |   select   |   insert   |   delete   | update     | references | rule       | trigger
  james   | rest       | TRUE:FALSE | TRUE:FALSE | TRUE:FALSE | TRUE:FALSE | TRUE:FALSE | TRUE:FALSE | TRUE:FALSE
  yondo   | rest       | TRUE:TRUE | TRUE:TRUE | FALSE:FALSE | TRUE:FALSE | TRUE:FALSE | FALSE:FALSE | FALSE:FALSE
  </code></pre>
  
  <p>I tried this: </p>
  
  <pre><code>SELECT grantee, table_name,
      CASE WHEN privilege_type = 'SELECT' AND is_grantable='YES' THEN 'TRUE:TRUE' 
          ELSE 'TRUE:FALSE' END as select, 
          CASE WHEN privilege_type = 'INSERT' AND is_grantable='YES' THEN 'TRUE:TRUE' 
          ELSE 'TRUE:FALSE' END as insert, 
          CASE WHEN privilege_type = 'DELETE' AND is_grantable='YES' THEN 'TRUE:TRUE' 
          ELSE 'TRUE:FALSE' END as delete
      FROM information_schema.table_privileges WHERE table_schema='test';
  </code></pre>
  
  <p>but not working. What will be solution</p>