Re: Can a function determine whether a primary key constraint exists on a table?

Поиск
Список
Период
Сортировка
От ptjm@interlog.com (Patrick TJ McPhee)
Тема Re: Can a function determine whether a primary key constraint exists on a table?
Дата
Msg-id 12iu6ivjiti162f@corp.supernews.com
обсуждение исходный текст
Ответ на Re: Can a function determine whether a primary key constraint exists on a table?  ("Albe Laurenz" <all@adv.magwien.gv.at>)
Список pgsql-general
In article <52EF20B2E3209443BC37736D00C3C1380AD5FEFF@EXADV1.host.magwien.gv.at>,
Albe Laurenz <all@adv.magwien.gv.at> wrote:

% >                                     How can I check for the
% > presence of constraints inside a function?
%
% select t.oid as tableid, t.relname as tablename,
%       c.oid as constraintid, conname as constraintname
% from pg_constraint c join pg_class t on (c.conrelid = t.oid);

or, perhaps simpler,

 select * from information_schema.table_constraints
  where constraint_type = 'PRIMARY KEY';

--

Patrick TJ McPhee
North York  Canada
ptjm@interlog.com

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

Предыдущее
От: roopa perumalraja
Дата:
Сообщение: Performance problem
Следующее
От: alexei.vladishev@gmail.com
Дата:
Сообщение: Re: more anti-postgresql FUD