Re: column depends on sequence

Поиск
Список
Период
Сортировка
От Joshua Tolley
Тема Re: column depends on sequence
Дата
Msg-id 4c5aba42.21078e0a.57a8.0c3f@mx.google.com
обсуждение исходный текст
Ответ на column depends on sequence  (AI Rumman <rummandba@gmail.com>)
Список pgsql-general
On Thu, Aug 05, 2010 at 06:23:54PM +0600, AI Rumman wrote:
>    I need to write a query to find the primary key column_names that depend
>    on sequences.
>    Any help please.

On the assumption that the sort of dependence you're looking for is one where
a column has a default value of nextval('some_sequence'), this worked for me:

select
    attrelid::regclass || '.' || attname,
    adsrc
from
    pg_attrdef ad
    join pg_attribute pa
        on (ad.adrelid = pa.attrelid and pa.attnum = ad.adnum)
where
    adsrc ~* 'nextval'

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

Вложения

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

Предыдущее
От: AI Rumman
Дата:
Сообщение: column depends on sequence
Следующее
От: 노현석
Дата:
Сообщение: how can we resolving locking state....