diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-07-30 21:23:17 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-07-30 21:23:17 +0000 |
commit | c8572986ad138142acbf3215bb14214926e25ce5 (patch) | |
tree | 95bc5fff11a7dbc144097bddda183777578fc3ea /src | |
parent | 7df49cef7258d06a7db819d7b5025d131cc226a2 (diff) | |
download | postgresql-c8572986ad138142acbf3215bb14214926e25ce5.tar.gz postgresql-c8572986ad138142acbf3215bb14214926e25ce5.zip |
Allow I/O conversion casts to be applied to or from any type that is a member
of the STRING type category, thereby opening up the mechanism for user-defined
types. This is mainly for the benefit of citext, though; there aren't likely
to be a lot of types that are all general-purpose character strings.
Per discussion with David Wheeler.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/parser/parse_coerce.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index df5ad09bae1..df1fb8526de 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.162 2008/07/30 17:05:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.163 2008/07/30 21:23:17 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1796,8 +1796,8 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId, /* * If we still haven't found a possibility, consider automatic casting - * using I/O functions. We allow assignment casts to textual types - * and explicit casts from textual types to be handled this way. (The + * using I/O functions. We allow assignment casts to string types + * and explicit casts from string types to be handled this way. (The * CoerceViaIO mechanism is a lot more general than that, but this is * all we want to allow in the absence of a pg_cast entry.) It would * probably be better to insist on explicit casts in both directions, @@ -1807,14 +1807,10 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId, if (result == COERCION_PATH_NONE) { if (ccontext >= COERCION_ASSIGNMENT && - (targetTypeId == TEXTOID || - targetTypeId == VARCHAROID || - targetTypeId == BPCHAROID)) + TypeCategory(targetTypeId) == TYPCATEGORY_STRING) result = COERCION_PATH_COERCEVIAIO; else if (ccontext >= COERCION_EXPLICIT && - (sourceTypeId == TEXTOID || - sourceTypeId == VARCHAROID || - sourceTypeId == BPCHAROID)) + TypeCategory(sourceTypeId) == TYPCATEGORY_STRING) result = COERCION_PATH_COERCEVIAIO; } } |