LISTAR TODAS LAS TABLAS DE UNA BASE
Para correr estos querys primero deben estar conectados en la base de donde requieran sacar el listado de las tablas
--LISTAR TODAS LAS TABLAS DE UNA BASE
select * from pg_catalog.pg_stat_user_tables
order by schemaname
--LISTAR TODAS LAS TABLAS DE UNA BASE CON DESCRIPCION
select * from pg_catalog.pg_stat_user_tables ut,pg_catalog.pg_description des
where ut.relid=des.objoid
select a.*, b.*, c.*
from pg_class a, pg_attribute b, pg_type c
where a.relname = 'tabla1'
and b.attrelid = a.relfilenode
and b.attnum >0
and b.atttypid = c.oid
select *,description
from information_schema.columns,pg_description
where table_name = 'tabla1';
SELECT c.table_schema,c.table_name,c.column_name,c.data_type ||'(' || c.character_maximum_length ||')' ,c.is_nullable,c.column_default,pgd.description FROM
pg_catalog.pg_statio_all_tables as st inner join pg_catalog.pg_description pgd on
(pgd.objoid=st.relid) inner join information_schema.columns c on (pgd.objsubid=c.ordinal_position and
c.table_schema=st.schemaname and c.table_name=st.relname);
Para correr estos querys primero deben estar conectados en la base de donde requieran sacar el listado de las tablas
--LISTAR TODAS LAS TABLAS DE UNA BASE
select * from pg_catalog.pg_stat_user_tables
order by schemaname
--LISTAR TODAS LAS TABLAS DE UNA BASE CON DESCRIPCION
select * from pg_catalog.pg_stat_user_tables ut,pg_catalog.pg_description des
where ut.relid=des.objoid
select a.*, b.*, c.*
from pg_class a, pg_attribute b, pg_type c
where a.relname = 'tabla1'
and b.attrelid = a.relfilenode
and b.attnum >0
and b.atttypid = c.oid
select *,description
from information_schema.columns,pg_description
where table_name = 'tabla1';
SELECT c.table_schema,c.table_name,c.column_name,c.data_type ||'(' || c.character_maximum_length ||')' ,c.is_nullable,c.column_default,pgd.description FROM
pg_catalog.pg_statio_all_tables as st inner join pg_catalog.pg_description pgd on
(pgd.objoid=st.relid) inner join information_schema.columns c on (pgd.objsubid=c.ordinal_position and
c.table_schema=st.schemaname and c.table_name=st.relname);