postgresql/src/backend/utils/adt
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
..
acl.c Basic foreign table support. 2011-01-01 23:48:11 -05:00
array_userfuncs.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
arrayfuncs.c Add FOREACH IN ARRAY looping to plpgsql. 2011-02-16 01:53:03 -05:00
arrayutils.c Use array_contains_nulls instead of ARR_HASNULL on user-supplied arrays. 2011-01-09 13:09:07 -05:00
ascii.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
bool.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
cash.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
char.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
date.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
datetime.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
datum.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
dbsize.c Prevent possible compiler warnings. 2011-02-17 16:01:46 -05:00
domains.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
encode.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
enum.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
float.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
format_type.c Per-column collation support 2011-02-08 23:04:18 +02:00
formatting.c Per-column collation support 2011-02-08 23:04:18 +02:00
genfile.c Properly handle Win32 paths of 'E:abc', which can be either absolute or 2011-02-12 09:47:51 -05:00
geo_ops.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
geo_selfuncs.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
inet_cidr_ntop.c When reporting the server as not responding, if the hostname was 2010-11-24 17:04:19 -05:00
inet_net_pton.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
int8.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
int.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
like_match.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
like.c Per-column collation support 2011-02-08 23:04:18 +02:00
lockfuncs.c Add transaction-level advisory locks. 2011-02-18 14:05:12 +09:00
mac.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Makefile When reporting the server as not responding, if the hostname was 2010-11-24 17:04:19 -05:00
misc.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
nabstime.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
name.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
network.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
numeric.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
numutils.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
oid.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
oracle_compat.c Per-column collation support 2011-02-08 23:04:18 +02:00
pg_locale.c Per-column collation support 2011-02-08 23:04:18 +02:00
pg_lzcompress.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
pgstatfuncs.c Add client_hostname field to pg_stat_activity. 2011-02-17 16:03:28 -05:00
pseudotypes.c Allow binary I/O of type "void". 2011-02-22 13:08:22 -05:00
quote.c Add PL/Python functions for quoting strings 2011-02-22 23:41:23 +02:00
regexp.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
regproc.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
ri_triggers.c Add a relkind field to RangeTblEntry to avoid some syscache lookups. 2011-02-22 19:24:40 -05:00
rowtypes.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
ruleutils.c Remove collation information from TypeName, where it does not belong. 2011-03-09 22:39:20 -05:00
selfuncs.c Fix bogus test for hypothetical indexes in get_actual_variable_range(). 2011-02-16 19:24:45 -05:00
tid.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
timestamp.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
trigfuncs.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsginidx.c Add backwards-compatible declarations of some core GIN support functions. 2011-02-16 17:24:46 -05:00
tsgistidx.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsquery_cleanup.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsquery_gist.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsquery_op.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsquery_rewrite.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsquery_util.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsquery.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsrank.c Use array_contains_nulls instead of ARR_HASNULL on user-supplied arrays. 2011-01-09 13:09:07 -05:00
tsvector_op.c Fix up core tsquery GIN support for new extractQuery API. 2011-01-09 14:34:50 -05:00
tsvector_parser.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
tsvector.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
txid.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
uuid.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
varbit.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
varchar.c Per-column collation support 2011-02-08 23:04:18 +02:00
varlena.c Per-column collation support 2011-02-08 23:04:18 +02:00
version.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
windowfuncs.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
xid.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
xml.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00