Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 6EE24EA3551 for ; Fri, 13 Jul 2012 12:06:19 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SphRe-00042e-0d for pgsql-bugs@postgresql.org; Fri, 13 Jul 2012 15:06:18 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q6DF5xqp001331; Fri, 13 Jul 2012 11:06:00 -0400 (EDT) From: Tom Lane To: Ryan Kelly cc: daniele.varrazzo@gmail.com, pgsql-bugs@postgresql.org Subject: Re: BUG #6734: create table (like ...) fails if an index has a comment In-reply-to: <20120713132419.GB2369@llserver.lakeliving.com> References: <20120713132419.GB2369@llserver.lakeliving.com> Comments: In-reply-to Ryan Kelly message dated "Fri, 13 Jul 2012 09:24:19 -0400" Date: Fri, 13 Jul 2012 11:05:59 -0400 Message-ID: <1330.1342191959@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/104 X-Sequence-Number: 33580 Ryan Kelly writes: > The comments on chooseIndexName in src/backend/parser/parse_utilcmd.c say: > * XXX this is inherently broken because the indexes aren't created > * immediately, so we fail to resolve conflicts when the same name is > * derived for multiple indexes. > Which looks like the case here. So it seems like > chooseIndexName/ChooseIndexName might need to take a list of any indexes > names that have already been created to avoid this. I think a cleaner fix might be for IndexStmt to grow the ability to specify a comment. What's bogus here is that transformTableLikeClause has to (try to) lock down the index name in advance of actual creation, because it wants to generate a plain vanilla CommentStmt. If it didn't have to do that, everything would be fine, and we could lose chooseIndexName altogether. ChooseIndexName is fine, because it's only run at the instant of index creation. regards, tom lane