Re: BUG #6734: create table (like ...) fails if an index has a comment

From: Ryan Kelly <rpkelly22(at)gmail(dot)com>
To: daniele(dot)varrazzo(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6734: create table (like ...) fails if an index has a comment
Date: 2012-07-13 13:24:19
Message-ID: 20120713132419.GB2369@llserver.lakeliving.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jul 13, 2012 at 12:00:14PM +0000, daniele(dot)varrazzo(at)gmail(dot)com wrote:
> The following bug has been logged on the website:
>
> Bug reference: 6734
> Logged by: Daniele Varrazzo
> Email address: daniele(dot)varrazzo(at)gmail(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

-Ryan Kelly

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message maxim.boguk 2012-07-13 13:38:47 BUG #6736: Hot-standby replica crashed after failover:
Previous Message tsialiam 2012-07-13 13:00:23 BUG #6735: PANIC: 42501: could not open control file "global/pg_control": Permission denied