Search Postgresql Archives

Re: Fwd: Need r_constraint_name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/22/2014 07:21 AM, Ramesh T wrote:


---------- Forwarded message ----------
From: *Ramesh T* <rameshparnanditech@xxxxxxxxx
<mailto:rameshparnanditech@xxxxxxxxx>>
Date: Tue, Jul 22, 2014 at 7:50 PM
Subject: Re: [GENERAL] Need r_constraint_name
To: Adrian Klaver <adrian.klaver@xxxxxxxxxxx
<mailto:adrian.klaver@xxxxxxxxxxx>>


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 still am not sure I am following.

If the inner query is on the child table, why are you selecting for 'PRIMARY KEY' and not 'FOREIGN KEY'?

That would sort of make sense if you where supplying the parent table name, but again a FOREIGN KEY references a UNIQUE constraint, which may or may not be a PRIMARY KEY. So restricting to a PRIMARY KEY will cause you to miss relationships.

What exactly are you looking for?


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.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>> 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..



--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux