postgresql/src/backend/utils
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
..
adt Remove collation information from TypeName, where it does not belong. 2011-03-09 22:39:20 -05:00
cache Support data-modifying commands (INSERT/UPDATE/DELETE) in WITH. 2011-02-25 18:58:02 -05:00
error Add some words of caution to elog.c. 2011-02-17 10:29:42 -05:00
fmgr Implement an API to let foreign-data wrappers actually be functional. 2011-02-20 00:18:14 -05:00
hash Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
init Log replication connections only when log_connections is on 2011-01-18 20:02:25 +01:00
mb Fix pg_server_to_client, that was broken in the previous commit. 2011-02-21 16:27:57 +09:00
misc Efficient transaction-controlled synchronous replication. 2011-03-06 22:49:16 +00:00
mmgr Run a portal's cleanup hook immediately when pushing it to DONE state. 2011-03-03 13:04:06 -05:00
resowner Implement genuine serializable isolation level. 2011-02-08 00:09:08 +02:00
sort Per-column collation support 2011-02-08 23:04:18 +02:00
time Rearrange snapshot handling to make rule expansion more consistent. 2011-02-28 23:28:06 -05:00
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
errcodes.txt Per-column collation support 2011-02-08 23:04:18 +02:00
Gen_dummy_probes.sed Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
Gen_fmgrtab.pl Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
generate-errcodes.pl Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
Makefile Make handling of errcodes.h more consistent with other generated headers. 2011-02-04 09:29:10 -05:00
probes.d Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00