Drop/ Alter index if exist

Started by Pau Marc Munoz Torresover 16 years ago3 messagesgeneral
Jump to latest
#1Pau Marc Munoz Torres
paumarc@gmail.com

Hi every body

there is some way to delete or rename an index only if this index exists?

something like

"alter index index rename to pepe if exists"

thanks

--
Pau Marc Muñoz Torres

Laboratori de Biologia Computacional
Institut de Biotecnologia i Biomedicina Vicent Villar

Universitat Autonoma de Barcelona
E-08193 Bellaterra (Barcelona)

telèfon: 93 5812807
Email : paumarc.munoz@bioinf.uab.cat

#2Filip Rembiałkowski
plk.zuber@gmail.com
In reply to: Pau Marc Munoz Torres (#1)
Re: Drop/ Alter index if exist

2009/12/22 Pau Marc Munoz Torres <paumarc@gmail.com>

Hi every body

there is some way to delete or rename an index only if this index exists?

something like

"alter index index rename to pepe if exists"

for drop - yes:
DROP INDEX IF EXISTS name;

for rename - there is no simple solution. well, actually there are solutions
but they are more complicated than the problem.
(think of user defined functions)

--
Filip Rembiałkowski
JID,mailto:filip.rembialkowski@gmail.com
http://filip.rembialkowski.net/

#3Pau Marc Munoz Torres
paumarc@gmail.com
In reply to: Filip Rembiałkowski (#2)
Re: Drop/ Alter index if exist

thanks

2009/12/22 Filip Rembiałkowski <plk.zuber@gmail.com>

2009/12/22 Pau Marc Munoz Torres <paumarc@gmail.com>

Hi every body

there is some way to delete or rename an index only if this index exists?

something like

"alter index index rename to pepe if exists"

for drop - yes:
DROP INDEX IF EXISTS name;

for rename - there is no simple solution. well, actually there are
solutions but they are more complicated than the problem.
(think of user defined functions)

--
Filip Rembiałkowski
JID,mailto:filip.rembialkowski@gmail.com
http://filip.rembialkowski.net/

--
Pau Marc Muñoz Torres

Laboratori de Biologia Computacional
Institut de Biotecnologia i Biomedicina Vicent Villar

Universitat Autonoma de Barcelona
E-08193 Bellaterra (Barcelona)

telèfon: 93 5812807
Email : paumarc.munoz@bioinf.uab.cat