pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ryan Kelly <rpkelly22@gmail.com>
To: daniele.varrazzo@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6734: create table (like ...) fails if an index has a comment
Date: Fri, 13 Jul 2012 09:24:19 -0400
Message-ID: <20120713132419.GB2369@llserver.lakeliving.com> (raw)
In-Reply-To: <E1SpeXe-0002yi-Rr@wrigleys.postgresql.org>
References: <E1SpeXe-0002yi-Rr@wrigleys.postgresql.org>

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



view thread (7+ messages)  latest in thread

Message-ID: <20120713132419.GB2369@llserver.lakeliving.com>
Permalink:  ../20120713132419.GB2369@llserver.lakeliving.com/
Also on:    postgresql.org/message-id/20120713132419.GB2369@llserver.lakeliving.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: rpkelly22@gmail.com, daniele.varrazzo@gmail.com
  Subject: Re: BUG #6734: create table (like ...) fails if an index has a comment
  In-Reply-To: <20120713132419.GB2369@llserver.lakeliving.com>
  References: <E1SpeXe-0002yi-Rr@wrigleys.postgresql.org> <20120713132419.GB2369@llserver.lakeliving.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox