Fwd: Need r_constraint_name

From: Ramesh T <rameshparnanditech(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Subject: Fwd: Need r_constraint_name
Date: 2014-07-22 14:21:10
Message-ID: CAK8Zd=uUO0BNtqpvD2=hOL7it=aF0-h2VbbLdrvW1vd=wpTBDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

---------- Forwarded message ----------
From: Ramesh T <rameshparnanditech(at)gmail(dot)com>
Date: Tue, Jul 22, 2014 at 7:50 PM
Subject: Re: [GENERAL] Need r_constraint_name
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>

Just i'm retriving the constraint_name when i enter child_table_name for
inner query and that constraint name is checking
parent_table on outer statement that constraint_name is equal then display
the constraint name ..?but outer select is r_constraint_name

i think in postgres r_constraint_name is also include in the pg_constraints
details not a seperate column in postgres for that ,if parent table have
consraint_name same as the child table return from inner query that
constraint_name displayed out..

my assumption..is it corect?
from last query..

thanks in advance..
ramesh

On Tue, Jul 22, 2014 at 7:18 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> 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(dot)klaver(at)aklaver(dot)com
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2014-07-22 14:24:42 Re: Referencing serial col's sequence for insert
Previous Message Adrian Klaver 2014-07-22 13:48:59 Re: Need r_constraint_name