pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dmitriy Igrishin <dmitigr@gmail.com>
Cc: postgres list <pgsql-sql@postgresql.org>
Subject: Re: Selecting names of indexes that are not dependent on constraints.
Date: Thu, 11 Mar 2010 10:34:47 -0500
Message-ID: <20643.1268321687@sss.pgh.pa.us> (raw)
In-Reply-To: <b4399d111003110715h1415e094paaf0d5e5e0ada46@mail.gmail.com>
References: <b4399d111003110715h1415e094paaf0d5e5e0ada46@mail.gmail.com>

Dmitriy Igrishin <dmitigr@gmail.com> writes:
> How can I select names of indexes of table (or even whole schema) that are
> not dependent on constraints?

Right at the moment, the only reliable way to tell whether an index is
associated with a constraint is to look for a pg_depend entry linking
the two.  Be careful to consider only "internal" dependencies, else you
may be fooled by foreign-key constraints that depend on indexes.
If you look into the pg_dump source code you will find an example.

9.0 will make this a tad simpler by keeping a "conindid" column in
pg_constraint.

			regards, tom lane



view thread (3+ messages)

Message-ID: <20643.1268321687@sss.pgh.pa.us>
Permalink:  ../20643.1268321687@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20643.1268321687@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dmitigr@gmail.com
  Subject: Re: Selecting names of indexes that are not dependent on constraints.
  In-Reply-To: <20643.1268321687@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox