postgresql/src/backend/commands
Tom Lane c92be3c059 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:18 -04:00
..
Makefile Restructure SELECT INTO's parsetree representation into CreateTableAsStmt. 2012-03-19 21:38:12 -04:00
aggregatecmds.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
alter.c Add support for renaming constraints 2012-03-10 20:19:13 +02:00
analyze.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
async.c Fix NOTIFY to cope with I/O problems, such as out-of-disk-space. 2012-06-29 00:51:34 -04:00
cluster.c Replace int2/int4 in C code with int16/int32 2012-06-25 01:51:46 +03:00
collationcmds.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
comment.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
constraint.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
conversioncmds.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
copy.c Skip text->binary conversion of unnecessary columns in contrib/file_fdw. 2012-07-12 16:26:59 -04:00
createas.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
dbcommands.c Add more message pluralization 2012-06-15 02:02:02 +03:00
define.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
discard.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
dropcmds.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
explain.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
extension.c Have REASSIGN OWNED work on extensions, too 2012-07-03 15:09:59 -04:00
foreigncmds.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
functioncmds.c Improve reporting of permission errors for array types 2012-06-15 22:55:03 +03:00
indexcmds.c Avoid pre-determining index names during CREATE TABLE LIKE parsing. 2012-07-16 13:25:18 -04:00
lockcmds.c Repair comment mangled by a pgindent run long ago 2012-06-21 15:37:05 -04:00
opclasscmds.c Improve reporting of permission errors for array types 2012-06-15 22:55:03 +03:00
operatorcmds.c Improve reporting of permission errors for array types 2012-06-15 22:55:03 +03:00
portalcmds.c Restructure SELECT INTO's parsetree representation into CreateTableAsStmt. 2012-03-19 21:38:12 -04:00
prepare.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
proclang.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
schemacmds.c Fix some issues with temp/transient tables in extension scripts. 2012-03-08 15:53:09 -05:00
seclabel.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
sequence.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
tablecmds.c Avoid pre-determining index names during CREATE TABLE LIKE parsing. 2012-07-16 13:25:18 -04:00
tablespace.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
trigger.c Replace int2/int4 in C code with int16/int32 2012-06-25 01:51:46 +03:00
tsearchcmds.c Extend object access hook framework to support arguments, and DROP. 2012-03-09 14:34:56 -05:00
typecmds.c Improve reporting of permission errors for array types 2012-06-15 22:55:03 +03:00
user.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
vacuum.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
vacuumlazy.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
variable.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
view.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00