postgresql/contrib/citext
Tom Lane 07eee5a0dc Create a new type category for "internal use" types.
Historically we've put type "char" into the S (String) typcategory,
although calling it a string is a stretch considering it can only
store one byte.  (In our actual usage, it's more like an enum.)
This choice now seems wrong in view of the special heuristics
that parse_func.c and parse_coerce.c have for TYPCATEGORY_STRING:
it's not a great idea for "char" to have those preferential casting
behaviors.

Worse than that, recent patches inventing special-purpose types
like pg_node_tree have assigned typcategory S to those types,
meaning they also get preferential casting treatment that's designed
on the assumption that they can hold arbitrary text.

To fix, invent a new category TYPCATEGORY_INTERNAL for internal-use
types, and assign that to all these types.  I used code 'Z' for
lack of a better idea ('I' was already taken).

This change breaks one query in psql/describe.c, which now needs to
explicitly cast a catalog "char" column to text before concatenating
it with an undecorated literal.  Also, a test case in contrib/citext
now needs an explicit cast to convert citext to "char".  Since the
point of this change is to not have "char" be a surprisingly-available
cast target, these breakages seem OK.

Per report from Ian Campbell.

Discussion: https://postgr.es/m/2216388.1638480141@sss.pgh.pa.us
2021-12-11 14:10:51 -05:00
..
expected Create a new type category for "internal use" types. 2021-12-11 14:10:51 -05:00
sql Create a new type category for "internal use" types. 2021-12-11 14:10:51 -05:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
Makefile Remove support for upgrading extensions from "unpackaged" state. 2020-02-19 16:59:14 -05:00
citext--1.0--1.1.sql Fix incorrect declaration of citext's regexp_matches() functions. 2015-05-05 15:51:22 -04:00
citext--1.1--1.2.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
citext--1.2--1.3.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
citext--1.3--1.4.sql Support the new regexp_match() function for citext. 2016-08-18 10:52:31 -04:00
citext--1.4--1.5.sql Add citext_pattern_ops for citext contrib module 2017-09-19 08:31:45 -04:00
citext--1.4.sql Support the new regexp_match() function for citext. 2016-08-18 10:52:31 -04:00
citext--1.5--1.6.sql Add a 64-bit hash function for type citext. 2018-11-23 13:24:45 -05:00
citext.c Move src/backend/utils/hash/hashfn.c to src/common 2020-02-27 09:25:41 +05:30
citext.control Mark some contrib modules as "trusted". 2020-02-13 15:02:35 -05:00