pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Giulio Orsero <giulioo@pobox.com>
To: Achilleus Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Drop all indexes of a table w/o knowing the index names
Date: Tue, 09 Nov 2004 20:55:03 +0100
Message-ID: <20041109195502.CE06213349@mail.golden.dom> (raw)
In-Reply-To: <Pine.LNX.4.44.0411091727100.4167-100000@matrix.gatewaynet.com>
References: <20041109144039.1B2D313346@mail.golden.dom>
	<Pine.LNX.4.44.0411091727100.4167-100000@matrix.gatewaynet.com>

On Tue, 9 Nov 2004 17:30:25 +0200 (EET), Achilleus Mantzios
<achill@matrix.gatewaynet.com> wrote:

>O Giulio Orsero Ýãñáøå óôéò Nov 9, 2004 :
>> I need a way to drop all indexes of a table without knowing the names of the
>> indexes.

>% foreach i ( `psql -t -q -c "SELECT ci.relname from pg_index i,pg_class 
>ci,pg_class ct where i.indexrelid=ci.oid and i.indrelid=ct.oid and 
>ct.relname='YOUR_TABLE_HERE'"` )
>foreach? psql -c "drop index $i" 
>foreach? end

Ok, worked as expected.

thanks

-- 
giulioo@pobox.com



view thread (3+ messages)

Message-ID: <20041109195502.CE06213349@mail.golden.dom>
Permalink:  ../20041109195502.CE06213349@mail.golden.dom/
Also on:    postgresql.org/message-id/20041109195502.CE06213349@mail.golden.dom

 · 

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: giulioo@pobox.com, achill@matrix.gatewaynet.com
  Subject: Re: Drop all indexes of a table w/o knowing the index names
  In-Reply-To: <20041109195502.CE06213349@mail.golden.dom>

* 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