Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 7D200EA3551 for ; Fri, 13 Jul 2012 10:24:38 -0300 (ADT) Received: from mail-qc0-f174.google.com ([209.85.216.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SpfrI-0002OR-6F for pgsql-bugs@postgresql.org; Fri, 13 Jul 2012 13:24:38 +0000 Received: by qcro28 with SMTP id o28so2126027qcr.19 for ; Fri, 13 Jul 2012 06:24:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=1fJfC5XdSqTbGSWHHHBK4NMp+7Z0Dmu3YGRxqc1xB9U=; b=bQZ2VWJkF/uboO86LhrbMDkvfX26FWIKjZBU8sCaCkrmE3klTPnvk+ztY81xHLvgME BYWwCj8zp1ldXISZosyh+VMawqEQ9jRtpviJB7tuLygEEGo+iQjdUBANBaiADQAIwyzn RiusbCH0odZSKrjND/EmIGz3aO1qnPgaavCuFINY2zLr/hSzCKk1Eh7jlwPPXtanJhUN mF7lkl4vUphgZOuQADVygzo1Iu7whN3/fgFB5jIH7z2YgPiSPjh5pNk3cMpammnhB7TX nfylkFw0qgJEeGEJdfozcxcrEc2Dq+PoORiu8aeBeBJyfsxaL6HJZoctOZygI7OxDsnT NItg== Received: by 10.224.208.194 with SMTP id gd2mr2622083qab.96.1342185863152; Fri, 13 Jul 2012 06:24:23 -0700 (PDT) Received: from llserver.lakeliving.com (ool-18bbd2c6.static.optonline.net. [24.187.210.198]) by mx.google.com with ESMTPS id ea5sm11122637qab.2.2012.07.13.06.24.21 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jul 2012 06:24:22 -0700 (PDT) Date: Fri, 13 Jul 2012 09:24:19 -0400 From: Ryan Kelly To: daniele.varrazzo@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6734: create table (like ...) fails if an index has a comment Message-ID: <20120713132419.GB2369@llserver.lakeliving.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.3 (-) X-Archive-Number: 201207/100 X-Sequence-Number: 33576 On Fri, Jul 13, 2012 at 12:00:14PM +0000, daniele.varrazzo@gmail.com wrote: > The following bug has been logged on the website: > > Bug reference: 6734 > Logged by: Daniele Varrazzo > Email address: daniele.varrazzo@gmail.com > PostgreSQL version: 9.1.4 > Operating system: Linux > Description: > > Weird, isn't it? Test case below. > > Dropping the comment, the create table command works as expected. The > command fails with an: "ERROR: relation "foo2_f1_idx" already exists". 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. > > begin; > > CREATE TABLE foo > ( > id serial primary key, > f1 integer NOT NULL > ); > > > CREATE INDEX foo_idx1 ON foo (f1); > > CREATE INDEX foo_idx2 ON foo (f1) WHERE id > 10; > > COMMENT ON INDEX foo_idx2 IS 'whatever'; > > create table foo2 (like foo including all); > > rollback; > > > > -- > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-bugs -Ryan Kelly