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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ryan Kelly <rpkelly22(at)gmail(dot)com>
Cc: daniele(dot)varrazzo(at)gmail(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6734: create table (like ...) fails if an index has a comment
Date: 2012-07-13 15:05:59
Message-ID: 1330.1342191959@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ryan Kelly <rpkelly22(at)gmail(dot)com> 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-07-13 15:11:41 Re: BUG #6734: create table (like ...) fails if an index has a comment
Previous Message Daniele Varrazzo 2012-07-13 14:52:59 Re: BUG #6734: create table (like ...) fails if an index has a comment