Re: BUG #6734: create table (like ...) fails if an index has a comment - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #6734: create table (like ...) fails if an index has a comment
Date
Msg-id 1330.1342191959@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #6734: create table (like ...) fails if an index has a comment  (Ryan Kelly <rpkelly22@gmail.com>)
List pgsql-bugs
Ryan Kelly <rpkelly22@gmail.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

pgsql-bugs by date:

Previous
From: Daniele Varrazzo
Date:
Subject: Re: BUG #6734: create table (like ...) fails if an index has a comment
Next
From: Tom Lane
Date:
Subject: Re: BUG #6734: create table (like ...) fails if an index has a comment