Re: Getting the column to a which a sequence belongs.

Поиск
Список
Период
Сортировка
Искать
От
Thomas Kellerer
Тема
Re: Getting the column to a which a sequence belongs.
Дата
Msg-id
h76o99$tq3$1@ger.gmane.org
Ответ на
Список
Дерево обсуждения
Getting the column to a which a sequence belongs. Thomas Kellerer <spam_eater@gmx.net>
Re: Getting the column to a which a sequence belongs. Sam Mason <sam@samason.me.uk>
Re: Getting the column to a which a sequence belongs. Thomas Kellerer <spam_eater@gmx.net>
Sam Mason wrote on 27.08.2009 21:51:
> The information is all in the system catalogs; I've not had much
> opportunity to fiddle with them so far but the following may be a start
> to help get things out for you.
> 
>   SELECT c.relname, a.attname, t.relname
>   FROM pg_class c, pg_depend d, pg_class t, pg_attribute a
>   WHERE c.relkind     = 'S'
>     AND d.objid       = c.oid
>     AND d.refobjid    = t.oid
>     AND (d.refobjid,d.refobjsubid) = (a.attrelid,a.attnum);
> 
Ah great, I didn't realize I could use pg_depend for this. 

Thanks, works like a charm! This is exactly what I was looking for.

Thomas
В списке pgsql-general по дате отправления
От: Sam Mason
Дата:
От: Sean Foreman
Дата:
FAQ