X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A5549DCD42 for ; Fri, 2 Dec 2005 18:33:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62916-01 for ; Fri, 2 Dec 2005 18:33:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 961ED9DCCA8 for ; Fri, 2 Dec 2005 18:33:42 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jB2MXijS008278; Fri, 2 Dec 2005 17:33:44 -0500 (EST) To: gry@ll.mit.edu cc: pgsql-sql@postgresql.org Subject: Re: rename idx's with table; avoid confusing idx names? In-reply-to: <20051202130037.38a45fbf.gry@ll.mit.edu> References: <20051202130037.38a45fbf.gry@ll.mit.edu> Comments: In-reply-to george young message dated "Fri, 02 Dec 2005 13:00:37 -0500" Date: Fri, 02 Dec 2005 17:33:44 -0500 Message-ID: <8277.1133562824@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/10 X-Sequence-Number: 23552 george young 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