New answers tagged


Have you tried \a, \pset pager off and \pset tuples_only? Let's start with \a and \pset pager off first: $ psql psql (9.3.22, server 10.13) WARNING: psql major version 9.3, server major version 10. Some psql features might not work. SSL connection (cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256) Type "help" for help. => \a Output ...


This is how you can list all privileges of a role (grantee): SELECT grantor, grantee, table_schema, table_name, privilege_type FROM information_schema.table_privileges WHERE grantee = 'myuser' Will result in: grantor | grantee | table_schema | table_name | privilege_type ----------+----------+--------------+------------+---------------- postgres | ...


Ok so based on @laurenz-albe solution and some thinkering about JSON option I built a query that solve the question in a more generic way but is ugly as hell. I guess someone more talented could wrap it into a PL/PGSQL function that take a query::text as input. Maybe relying on JSON function not being the best idea because I'm not sure how it will handle ...


Are you looking for this: WITH foobar(foo, bar) AS ( VALUES (1::integer,'a'::text), (2,'b'), (3,'c'), (4,'d') ) SELECT format('(%s, %L),', foo, bar) FROM foobar; format ----------- (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (4 rows)

Top 50 recent answers are included