Re: Drop all indexes of a table w/o knowing the index names

From: Giulio Orsero <giulioo(at)pobox(dot)com>
To: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Drop all indexes of a table w/o knowing the index names
Date: 2004-11-09 19:55:03
Message-ID: 20041109195502.CE06213349@mail.golden.dom
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 9 Nov 2004 17:30:25 +0200 (EET), Achilleus Mantzios
<achill(at)matrix(dot)gatewaynet(dot)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(at)pobox(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message carex 2004-11-09 20:02:26 select using regexp does not use indexscan
Previous Message Markus Schaber 2004-11-09 17:59:31 Re: [SQL] upper/lower for german characters