Re: comparing output of internal pg tables of referenced tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: comparing output of internal pg tables of referenced tables
Дата
Msg-id 24571.1568910502@sss.pgh.pa.us
обсуждение исходный текст
Ответ на comparing output of internal pg tables of referenced tables  (Mariel Cherkassky <mariel.cherkassky@gmail.com>)
Ответы Slow query on a one-tuple table  (Luís Roberto Weck <luisroberto@siscobra.com.br>)
Список pgsql-performance
Mariel Cherkassky <mariel.cherkassky@gmail.com> writes:
> 2)select conname,  (select r.relname from pg_class r where r.oid =
> c.confrelid) as orig_table,    (select array_agg(attname) from pg_attribute
>    where attrelid = c.confrelid and ARRAY[attnum] <@ c.conkey) as
> orig_cols,  (select r.relname from pg_class r where r.oid = c.conrelid) as
> foreign_table,      (select array_agg(attname) from pg_attribute    where
> attrelid = c.conrelid and ARRAY[attnum] <@ c.conkey) as foreign_cols from
> pg_constraint c   where c.confrelid = (select oid from pg_class where
> relname = '*my_table*') and c.contype='f'

> On the second output in the orig_cols I got a few weird outputs like
> : {........pg.dropped.5........} or even a columns that doesnt have a
> unique index (just a random column from the orig_table).

You need to be looking at confkey not conkey for the columns in the
confrelid table.

            regards, tom lane



В списке pgsql-performance по дате отправления:

Предыдущее
От: Joao Junior
Дата:
Сообщение: Delete huge Table under XFS
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Delete huge Table under XFS