List views columns in Vertica

Query below lists all columns in views in Vertica database

Query

select table_schema as view_schema,
       table_name as view_name,
       ordinal_position as pos,
       column_name,
       data_type,
       character_maximum_length as max_length,
       case when numeric_precision is null
            then datetime_precision
            else numeric_precision end as precision,
       numeric_scale as scale
from v_catalog.view_columns
order by table_schema,
         table_name,
        ordinal_position;

Columns

  • view_schema - view owner, schema name
  • view_name - view name
  • pos - column position in the view
  • column_name - column name
  • data_type - column datatype
  • max_length - character column maximum length
  • max_length - column length in bytes
  • precision - numeric precision for numeric data type and time precision for timestamp data type (if specified)
  • scale - numeric scale

Rows

  • One row represents one column in a specific view in a database
  • Scope of rows: all columns in views in Vertica database
  • Ordered by view schema, view name, column position within view

Sample results