Com o auxilio de vocês, pude resolver o problema.

Como solução, foi realizado uma instrução ao banco de dados, que
retornou os nomes das tabelas e respectivos registros tipo char, varchar
e text.

Assim sendo, foi realizado um update por tabela, aplicando o trim nos
respectivos registros. Isto foi feito através de código em um
aplicativo.

Muito obrigado a todos.


Antonio Prado.



Em Qui, 2008-11-13 às 08:39 -0200, Euler Taveira de Oliveira escreveu:
> Antonio Prado escreveu:
> > Em Qui, 2008-11-13 às 08:50 -0200, Fernando Grassi de Oliveira escreveu:
> >> nome do regsitro = nome da coluna certo?
> >>  ps.attname = nome da coluna
> > 
> > Na forma abaixo, estou tendo retorno com registros e tabela repetidos.
> > Devo utilizar group by ou pode ser aprimorado de outra forma ?
> > 
> > select  ps.tablename
> >         ,ps.attname
> >         ,pt.typname
> >         from pg_stats ps
> >         ,pg_attribute pa
> >         ,pg_type pt
> >         where schemaname='public'
> >         and ps.attname=pa.attname
> >         and pt.typelem=pa.atttypid
> >         and pt.typname='_varchar'
> >         order by ps.tablename
> > 
> Não utilize a tabela do catálogo pg_stats para isso. Além disso você
> precisa selecionar somente tabelas e atributos visíveis. Para isso, execute:
> 
> euler=# \d foo
>               Tabela "public.foo"
>  Coluna |         Tipo          | Modificadores
> --------+-----------------------+---------------
>  a      | integer               |
>  b      | character varying(10) |
>  c      | text                  |
>  d      | character varying(20) |
> 
> euler=# select n.nspname,c.relname,a.attname,format_type(a.atttypid,
> a.atttypmod) as type from pg_namespace n, pg_class c, pg_attribute a
> where n.oid = c.relnamespace and c.oid = a.attrelid and relkind = 'r'
> and attnum > 0 and
> euler-# nspname = 'public' and relname = 'foo' and
> format_type(a.atttypid, a.atttypmod) ~ 'character varying';
>  nspname | relname | attname |         type
> ---------+---------+---------+-----------------------
>  public  | foo     | b       | character varying(10)
>  public  | foo     | d       | character varying(20)
> (2 registros)
> 
> 
-- 
Antonio Prado
(62) 8174 4383
(62) 3278 0111
www.antonioprado.eti.br
[EMAIL PROTECTED]


_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a