Is there a way how you can cast the following result to array?
select pg_tables from pg_tables
This will return one column only, however the data type is not array.
Edit: I’m using PostgreSql 9.1.4
Update: I need an equivalent of the following SQL statement, without the need to write column names, applicable for every table:
select
string_to_array(
schemaname || '|' ||
tablename || '|' ||
tableowner || '|' ||
coalesce(tablespace,'') || '|' ||
hasindexes || '|' ||
hasrules || '|' ||
hastriggers
,'|')
from
pg_tables
Might be this: http://www.sqlfiddle.com/#!1/d41d8/364
How it works (inside-out), 5 steps:
1st:
Sample Output:
2nd:
Sample Output:
3rd:
Sample Output:
4th:
Sample Output:
Finally:
Sample Output:
Live test: http://www.sqlfiddle.com/#!1/d41d8/373
To prove that it works:
Sample output: