tabatt
set search_path to public, rugby, ere;
SELECT n.nspname as schema, c.relname as tname, a.attname as attr,
pg_catalog.format_type(a.atttypid, a.atttypmod) as type,
(select case when a.attnotnull then 'NOT NULL' else '' end) as nn,
(select case when a.atthasdef then 'HAS DEFAULT' else '' end) as hd,
a.attnum as attnum,
CASE c.relkind
WHEN 'r' THEN '#0000CC'
WHEN 'v' THEN '#009900'
WHEN 'i' THEN '#FF9933'
WHEN 'S' THEN '#FF0000'
WHEN 's' THEN '#CC33CC'
END as ttypecolor,
CASE c.relkind
WHEN 'r' THEN 'Table'
WHEN 'v' THEN 'View'
WHEN 'i' THEN 'Index'
WHEN 'S' THEN 'Sequence'
WHEN 's' THEN 'Special'
END as ttype
FROM pg_catalog.pg_attribute a, pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE pg_catalog.pg_table_is_visible(c.oid)
:vtable: :vschema:
AND a.attrelid = c.oid
AND a.attnum > 0
AND NOT a.attisdropped
ORDER BY schema, tname, a.attnum;
schema, tname, attr, type, nn, hd, attnum, ttypecolor,ttype
schema, tname, attnum
PostgreSQL Catalogs: Table Attributes by Schema & Table
PostgreSQL Catalogs:
Table Attributes by Schema & Table
This is an example of a three level report with two variables,
schema name and table name.
This report also shows fun with colors and tables.
| Relation Type Key |
| |
Table |
|
View |
|
Index |
|
Sequence |
|
Special |
|
|
| |
|
| |
|
| Column | Type | Modifiers |
| _attr_ |
_type_ |
_nn_ _hd_ |
|