See the WHERE clause of a partial index

From: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: See the WHERE clause of a partial index
Date: 2012-09-14 18:53:07
Message-ID: CA+6hpang=_GqNXrUtZ87zkfiKH21hc07n0KyJi9j0-3LxhWo6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I created some indexes with WHERE clauses, so that only part of the
table would be indexed. Now I'd like to get a list of indexes, and
include the WHERE clause if an index has one. This is what I'm trying
right now:

SELECT indc.relname, ind.indpred
FROM pg_index ind, pg_class indc
WHERE indc.oid = ind.indexrelid;

But that gives results like this:

relname | indpred
--------------------+------------------------
. . .
index_pwords_on_language_id | NULL
index_user_languages_on_user_id_and_language_id |
{NULLTEST :arg {VAR :varno 1 :varattno 6 :vartype 1114 :vartypmod -1
:varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 6 :location 128}
:nulltesttype 0 :argisrow false}
index_user_lists_on_user_id | NULL
index_users_on_email | NULL
. . .

I'm not sure how to interpret that `indpred` column. Is there any way
to reconstruct the WHERE clause I originally passed to the CREATE
INDEX command?

Thanks,
Paul

--
_________________________________
Pulchritudo splendor veritatis.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-09-14 19:18:43 Re: See the WHERE clause of a partial index
Previous Message Scott Marlowe 2012-09-14 17:20:05 Re: OFFTOPIC: core dumped with strcpy,atoi,sprintf.