george young <gry@ll.mit.edu> writes:
> I put together a plpgsql function to rename a table and it's indexes
> correspondingly[see below]. I would like to know:
> Is there a more robust/portable/clear way to do this?
> Is this a bad idea for some subtle reason?
It won't work if the table and column names are so long as to require
truncation to form an index name. Also there are some corner cases
in which you'll collide with existing index names. (The underlying
backend index-name creation logic goes to some effort to generate
nonconflicting index names, but this code isn't doing any such thing.)
regards, tom lane