pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Childs <peterachilds@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: Drop All Index
Date: Mon, 27 Nov 2006 14:47:59 +0000
Message-ID: <a2de01dd0611270647j17fb3537ra96a6af8e3caf3b9@mail.gmail.com> (raw)
In-Reply-To: <20061127142722.GC4432@alvh.no-ip.org>
References: <c13f2d590611260752m29a30734p2e30c42558fd068@mail.gmail.com>
	<20061127142722.GC4432@alvh.no-ip.org>

On 27/11/06, Alvaro Herrera <alvherre@commandprompt.com> wrote:
> Marcelo Costa wrote:
> > Hi to all,
> >
> > Anybody can help me how to proced to delete all index from my database,
> > exists any command to this ?
>
> Sure, you can create a PL/pgSQL function that loops around a "select
> relname from pg_class where relkind='i' AND ..." and then issues DROP
> INDEX for each (or you can do it in shell).  Be careful to include a
> clause to select only indexes that are not in system catalogs!
>
> --

Why do you want to?

If you are going to do that you'll have problems with Primary Keys
because you can't drop primary key indexes with drop index so you'll
get quite a few error messages. If you want to remove them you need
"alter table x drop constraint y;"

Peter.



view thread (5+ messages)  latest in thread

Message-ID: <a2de01dd0611270647j17fb3537ra96a6af8e3caf3b9@mail.gmail.com>
Permalink:  ../a2de01dd0611270647j17fb3537ra96a6af8e3caf3b9@mail.gmail.com/
Also on:    postgresql.org/message-id/a2de01dd0611270647j17fb3537ra96a6af8e3caf3b9@mail.gmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: peterachilds@gmail.com
  Subject: Re: Drop All Index
  In-Reply-To: <a2de01dd0611270647j17fb3537ra96a6af8e3caf3b9@mail.gmail.com>
  References: <c13f2d590611260752m29a30734p2e30c42558fd068@mail.gmail.com> <20061127142722.GC4432@alvh.no-ip.org> <a2de01dd0611270647j17fb3537ra96a6af8e3caf3b9@mail.gmail.com>

* 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