X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 186B43A3E9C for ; Tue, 9 Nov 2004 19:56:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47000-08 for ; Tue, 9 Nov 2004 19:56:09 +0000 (GMT) Received: from wnx-5a.seeweb.it (wnx-5a.seeweb.it [212.25.170.113]) by svr1.postgresql.org (Postfix) with ESMTP id EF96A3A3E91 for ; Tue, 9 Nov 2004 19:56:08 +0000 (GMT) Received: from mail.golden.dom ([213.255.43.90]) (authenticated bits=0) by wnx-5a.seeweb.it (8.12.3/8.12.3/Debian-6.6) with ESMTP id iA9JtvRd008761; Tue, 9 Nov 2004 20:56:03 +0100 From: Giulio Orsero To: Achilleus Mantzios 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 Organization: nowhere References: <20041109144039.1B2D313346@mail.golden.dom> In-Reply-To: X-Mailer: Forte Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-Id: <20041109195502.CE06213349@mail.golden.dom> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/88 X-Sequence-Number: 19407 On Tue, 9 Nov 2004 17:30:25 +0200 (EET), Achilleus Mantzios 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