List all computed columns in MariaDB database

Query below lists all computed columns in MariaDB database

Query

select table_schema as database_name,
       table_name,
       column_name,
       data_type,
       generation_expression
from information_schema.columns
where is_generated = 'ALWAYS' 
      and table_schema not in ('information_schema', 'sys',
                               'performance_schema', 'mysql')
order by table_schema,
         table_name,
         column_name;

Columns

  • database_name - database (schema) name containing table
  • table_name - table name
  • column_name - name of the column
  • data_type - data type of column
  • generation_expression - computing formula

Rows

  • One row represents one column
  • Scope of rows: represents all computed columns from all databases (schemas)
  • Ordered by database name, table name and column name

Sample results