Re: Extracting Index Creation Script

From: "Vyacheslav Kalinin" <vka(at)mgcp(dot)com>
To: "Paul Silveira" <plabrh1(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Extracting Index Creation Script
Date: 2007-10-24 04:52:31
Message-ID: 9b1af80e0710232152g7e91dccdqc65c5f4830bea642@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If you know the index name then:
SELECT pg_get_indexdef('your_index_name'::regclass)
will do.

In case you want a full list of indices for a certain table:
SELECT c2.relname, pg_get_indexdef(i.indexrelid, 0, true), c2.reltablespace
FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i
WHERE c.oid = 'your_table_name'::regclass AND c.oid = i.indrelid AND
i.indexrelid = c2.oid

If you have more questions of that kind try starting psql with -E option
which enables internal queries' display (this is what I did).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2007-10-24 05:57:39 (Never?) Kill Postmaster?
Previous Message Peter Manchev 2007-10-24 04:47:11 function result cache for pl/pgsql