Re:

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2017-05-07 12:57:01
Message-ID: CAKJS1f-RSWxgNzWNWjC-JiMYrN86UjqVLmnx_R8iY7rpg_h9jg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

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

In response to

  • Re: at 2017-05-07 12:42:22 from Igor Korot

Responses

  • Re: at 2017-05-07 15:09:35 from Tom Lane
  • Re: at 2017-05-07 17:40:13 from Igor Korot

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-05-07 15:09:35 Re:
Previous Message Igor Korot 2017-05-07 12:42:22 Re: