postgresql/src/backend/commands
Tom Lane a051ef699c Remove collation information from TypeName, where it does not belong.
The initial collations patch treated a COLLATE spec as part of a TypeName,
following what can only be described as brain fade on the part of the SQL
committee.  It's a lot more reasonable to treat COLLATE as a syntactically
separate object, so that it can be added in only the productions where it
actually belongs, rather than needing to reject it in a boatload of places
where it doesn't belong (something the original patch mostly failed to do).
In addition this change lets us meet the spec's requirement to allow
COLLATE anywhere in the clauses of a ColumnDef, and it avoids unfriendly
behavior for constructs such as "foo::type COLLATE collation".

To do this, pull collation information out of TypeName and put it in
ColumnDef instead, thus reverting most of the collation-related changes in
parse_type.c's API.  I made one additional structural change, which was to
use a ColumnDef as an intermediate node in AT_AlterColumnType AlterTableCmd
nodes.  This provides enough room to get rid of the "transform" wart in
AlterTableCmd too, since the ColumnDef can carry the USING expression
easily enough.

Also fix some other minor bugs that have crept in in the same areas,
like failure to copy recently-added fields of ColumnDef in copyfuncs.c.

While at it, document the formerly secret ability to specify a collation
in ALTER TABLE ALTER COLUMN TYPE, ALTER TYPE ADD ATTRIBUTE, and
ALTER TYPE ALTER ATTRIBUTE TYPE; and correct some misstatements about
what the default collation selection will be when COLLATE is omitted.

BTW, the three-parameter form of format_type() should go away too,
since it just contributes to the confusion in this area; but I'll do
that in a separate patch.
2011-03-09 22:39:20 -05:00
..
aggregatecmds.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
alter.c DDL support for collations 2011-02-12 15:55:18 +02:00
analyze.c Per-column collation support 2011-02-08 23:04:18 +02:00
async.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
cluster.c Core support for "extensions", which are packages of SQL objects. 2011-02-08 16:13:22 -05:00
collationcmds.c Remove collation information from TypeName, where it does not belong. 2011-03-09 22:39:20 -05:00
comment.c Allow non-superusers to create (some) extensions. 2011-03-04 16:08:53 -05:00
constraint.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
conversioncmds.c Core support for "extensions", which are packages of SQL objects. 2011-02-08 16:13:22 -05:00
copy.c Rearrange snapshot handling to make rule expansion more consistent. 2011-02-28 23:28:06 -05:00
dbcommands.c DDL support for collations 2011-02-12 15:55:18 +02:00
define.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
discard.c Refactor the executor's API to support data-modifying CTEs better. 2011-02-27 13:44:12 -05:00
explain.c Include the target table in EXPLAIN output for ModifyTable nodes. 2011-03-01 11:37:01 -05:00
extension.c Create extension infrastructure for the core procedural languages. 2011-03-04 21:51:14 -05:00
foreigncmds.c Create the catalog infrastructure for foreign-data-wrapper handlers. 2011-02-19 00:07:15 -05:00
functioncmds.c Remove collation information from TypeName, where it does not belong. 2011-03-09 22:39:20 -05:00
indexcmds.c Per-column collation support 2011-02-08 23:04:18 +02:00
lockcmds.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
Makefile DDL support for collations 2011-02-12 15:55:18 +02:00
opclasscmds.c Core support for "extensions", which are packages of SQL objects. 2011-02-08 16:13:22 -05:00
operatorcmds.c Core support for "extensions", which are packages of SQL objects. 2011-02-08 16:13:22 -05:00
portalcmds.c Refactor the executor's API to support data-modifying CTEs better. 2011-02-27 13:44:12 -05:00
prepare.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
proclang.c Core support for "extensions", which are packages of SQL objects. 2011-02-08 16:13:22 -05:00
schemacmds.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
seclabel.c Refactor seclabel.c to use the new check_object_ownership function. 2011-03-04 17:26:37 -05:00
sequence.c Remove collation information from TypeName, where it does not belong. 2011-03-09 22:39:20 -05:00
tablecmds.c Remove collation information from TypeName, where it does not belong. 2011-03-09 22:39:20 -05:00
tablespace.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
trigger.c Refactor the executor's API to support data-modifying CTEs better. 2011-02-27 13:44:12 -05:00
tsearchcmds.c Core support for "extensions", which are packages of SQL objects. 2011-02-08 16:13:22 -05:00
typecmds.c Remove collation information from TypeName, where it does not belong. 2011-03-09 22:39:20 -05:00
user.c Adjust the permissions required for COMMENT ON ROLE. 2011-03-09 11:28:34 -05:00
vacuum.c Avoid having autovacuum workers wait for relation locks. 2011-02-07 22:04:29 -05:00
vacuumlazy.c Don't throw a warning if vacuum sees PD_ALL_VISIBLE flag set on a page that 2011-03-08 20:30:53 +02:00
variable.c Implement genuine serializable isolation level. 2011-02-08 00:09:08 +02:00
view.c Remove collation information from TypeName, where it does not belong. 2011-03-09 22:39:20 -05:00