Boa tarde eu fiz algo parecido mais com a seguinte consulta espero te ajude.
SELECT * FROM information_schema.columns AS schema_public WHERE schema_public.table_schema = 'public' AND schema_public.column_default is not null AND schema_public.column_default not like 'nextval%' 2017-10-09 17:21 GMT-03:00 Fabrízio de Royes Mello <fabri...@timbira.com.br> : > Em 9 de outubro de 2017 17:18, Fabrízio de Royes Mello < > fabri...@timbira.com.br> escreveu: > > > > > > Em 9 de outubro de 2017 17:12, André Ormenese <aormen...@gmail.com> > escreveu: > > > > > > Boa tarde > > > > > > Preciso listar todos as colunas, de todas as tabelas, que tenham o > valor default definido. Independente do valor configurado. > > > Onde acho estas informações no catalogo do PostgreSQL 9.6.5 ? > > > > > > > André, > > > > Essa informação fica armazenada na tabela pg_attrdef [1] do catálogo. > > > > Att, > > > > [1] https://www.postgresql.org/docs/current/static/catalog- > pg-attrdef.html > > > > Apenas para ilustrar o que comentei no email anterior: > > fabrizio=# CREATE TABLE foo (f1 SERIAL PRIMARY KEY, f2 TIMESTAMP, f3 TEXT > DEFAULT 'bar', f4 INTEGER); > CREATE TABLE > fabrizio=# SELECT a.attrelid, a.attname, b.adsrc FROM pg_attribute a JOIN > pg_attrdef b ON b.adrelid = a.attrelid AND b.adnum = a.attnum where > attrelid = 'foo'::regclass; > attrelid | attname | adsrc > ----------+---------+--------------------------------- > 102722 | f1 | nextval('foo_f1_seq'::regclass) > 102722 | f3 | 'bar'::text > (2 rows) > > > Att, > > -- > Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/ > PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento > > _______________________________________________ > pgbr-geral mailing list > pgbr-geral@listas.postgresql.org.br > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral > -- Manuel Alejandro Garcia Mellado Ingeniero Ejecución en Informática e computación Concepcion - Chile VIII Region del Bio - Bio
_______________________________________________ pgbr-geral mailing list pgbr-geral@listas.postgresql.org.br https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral