postgresql/src/include/commands
Tom Lane 3727240d01 Avoid pre-determining index names during CREATE TABLE LIKE parsing.
Formerly, when trying to copy both indexes and comments, CREATE TABLE LIKE
had to pre-assign names to indexes that had comments, because it made up an
explicit CommentStmt command to apply the comment and so it had to know the
name for the index.  This creates bad interactions with other indexes, as
shown in bug #6734 from Daniele Varrazzo: the preassignment logic couldn't
take any other indexes into account so it could choose a conflicting name.

To fix, add a field to IndexStmt that allows it to carry a comment to be
assigned to the new index.  (This isn't a user-exposed feature of CREATE
INDEX, only an internal option.)  Now we don't need preassignment of index
names in any situation.

I also took the opportunity to refactor DefineIndex to accept the IndexStmt
as such, rather than passing all its fields individually in a mile-long
parameter list.

Back-patch to 9.2, but no further, because it seems too dangerous to change
IndexStmt or DefineIndex's API in released branches.  The bug exists back
to 9.0 where CREATE TABLE LIKE grew the ability to copy comments, but given
the lack of prior complaints we'll just let it go unfixed before 9.2.
2012-07-16 13:25:26 -04:00
..
alter.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
async.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
cluster.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
collationcmds.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
comment.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
conversioncmds.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
copy.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
createas.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
dbcommands.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
defrem.h Avoid pre-determining index names during CREATE TABLE LIKE parsing. 2012-07-16 13:25:26 -04:00
discard.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
explain.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
extension.h Have REASSIGN OWNED work on extensions, too 2012-07-03 15:18:40 -04:00
lockcmds.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
portalcmds.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
prepare.h Restructure SELECT INTO's parsetree representation into CreateTableAsStmt. 2012-03-19 21:38:12 -04:00
proclang.h Further consolidation of DROP statement handling. 2011-11-17 21:32:34 -05:00
schemacmds.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
seclabel.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
sequence.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
tablecmds.h Prevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars. 2012-06-30 16:45:27 -04:00
tablespace.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
trigger.h Add pg_trigger_depth() function 2012-01-25 13:22:54 -03:00
typecmds.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
user.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
vacuum.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
variable.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
view.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00