Re: Need r_constraint_name

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Need r_constraint_name
Дата
Msg-id 53CE6BCB.3000809@aklaver.com
обсуждение исходный текст
Ответ на Need r_constraint_name  (Ramesh T <rameshparnanditech@gmail.com>)
Список pgsql-general
On 07/22/2014 03:12 AM, Ramesh T wrote:
> thank u ,
>
> SELECT constraint_name
>                  FROM information_schema.table_constraints AS tc
>         WHERE     tc.table_name = p_table_name
>               AND constraint_name IN (SELECT constraint_name
>                                         FROM
> information_schema.table_constraints AS tc
>                                        WHERE     tc.table_name =
>                                                     p_ref_table_name
>                                              AND tc.constraint_type =
>                                                     'PRIMARY KEY');
>
> is this correct process same as above ..
>
> but i want check "r_constraint_name" instead of "constraint_name"  in
> outer statement in above code..

I am not sure you are going to find that column. I am not an Oracle user
but I did find this:

http://docs.oracle.com/html/B13531_01/ap_d.htm

R_CONSTRAINT_NAME is the name of the unique constraint definition for
the referenced table.

So it would seem r_constraint_name is an column name in an Oracle system
view. I know of no such name in the Postgres system catalog. I am sure
the same information is available, you are just going to have to be
specific about what you are looking for. From the above that would seem
to be the name of the unique key that a foreign key references.

Is that correct?

If so the query you show above will not work as a UNIQUE key does not
necessarily have to be the PRIMARY KEY.

>
> please let me know..
>
> thanks in advance,
> ramesh
>

--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Albe Laurenz
Дата:
Сообщение: Re: Referencing serial col's sequence for insert
Следующее
От: David G Johnston
Дата:
Сообщение: Re: Referencing serial col's sequence for insert