deeejay icon

psql - View column names and date types for a table or view

deeejay | PRO | 02/13/15 05:25:37 PM UTC | 0 ⭐ | 430 👁️ | Never ⏰ | []
PostgreSQL |

480 B

|

None

|

0 👍

/

0 👎

Query for specific view
===
SELECT column_name, data_type
FROM   information_schema.columns
WHERE  table_name = 'vw_some_view_name'
ORDER  BY ordinal_position;
 
Query all tables and views within a database and/or schema
===
SELECT table_catalog, table_schema, table_name, column_name, data_type, character_maximum_length
FROM   information_schema.columns
WHERE  table_name NOT LIKE 'pg_%'
AND domain_schema IS NULL
AND table_schema = 'allied'
ORDER BY table_name, ordinal_position;

Comments