Re: Selecting names of indexes that are not dependent on constraints.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
Cc: postgres list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Selecting names of indexes that are not dependent on constraints.
Date: 2010-03-11 15:34:47
Message-ID: 20643.1268321687@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dmitriy Igrishin <dmitigr(at)gmail(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message dennis 2010-03-11 16:07:44 Re: Help : insert a bytea data into new table
Previous Message Dmitriy Igrishin 2010-03-11 15:20:44 Re: Selecting names of indexes that are not dependent on constraints.