Re:

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2017-05-11 02:45:13
Message-ID: CA+FnnTx--N8iyhA5uP0jUkNR_+oqT=4BCrpVmKHsP6WD5MiCGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, guys,

On Sun, May 7, 2017 at 1:40 PM, Igor Korot <ikorot01(at)gmail(dot)com> wrote:
> David,
>
> On Sun, May 7, 2017 at 8:57 AM, David Rowley
> <david(dot)rowley(at)2ndquadrant(dot)com> wrote:
>> On 8 May 2017 at 00:42, Igor Korot <ikorot01(at)gmail(dot)com> wrote:
>>> Basically what I'd like to see is the definition of each column and
>>> whether this column is
>>> part of primary/foreign key or not.
>>
>> information_schema.table_constraints is of no use to you then. There
>> are no details about which column(s) the constraint applies to.
>>
>> Likely you'll want to look at pg_constraint for contype in('p','f')
>> and unnest(conkey) and join that to information_schema.columns. You
>> may also need to think about pg_constraint.confkey, depending on if
>> you want to know if the column is referencing or referenced in a
>> foreign key constraint.
>
> I checked pg_constraint view, but I didn't see anything to join to.
> I do see a table name, but no schema or column name.
>
> Any idea on the query syntax?

I found this: https://wiki.postgresql.org/wiki/Retrieve_primary_key_columns,
but now I need
to connect this with information_schema.columns.

What is best way to do it?

Or maybe that query I referenced is completely wrong?

Please help.

Thank you.

>
> Thank you.
>
>>
>>
>>
>> --
>> David Rowley http://www.2ndQuadrant.com/
>> PostgreSQL Development, 24x7 Support, Training & Services

In response to

  • Re: at 2017-05-07 17:40:13 from Igor Korot

Responses

  • Re: at 2017-05-11 03:02:39 from John R Pierce

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2017-05-11 03:02:39 Re:
Previous Message Stephen Frost 2017-05-11 00:26:07 Re: Querying a policy