diff options
| author | Tom Lane | 2011-03-20 16:43:39 +0000 |
|---|---|---|
| committer | Tom Lane | 2011-03-20 16:44:13 +0000 |
| commit | 176d5bae1d636fc1e91840b12cbd04c96d638b7e (patch) | |
| tree | f861d3f9d9eb2bead0cd932e7825271fb1fbc1e1 /src/include | |
| parent | c2f4ea469b52e6f7fedff651a4aa0acced873a5f (diff) | |
Fix up handling of C/POSIX collations.
Install just one instance of the "C" and "POSIX" collations into
pg_collation, rather than one per encoding. Make these instances exist
and do something useful even in machines without locale_t support: to wit,
it's now possible to force comparisons and case-folding functions to use C
locale in an otherwise non-C database, whether or not the platform has
support for using any additional collations.
Fix up severely broken upper/lower/initcap functions, too: the C/POSIX
fastpath now does what it is supposed to, and non-default collations are
handled correctly in single-byte database encodings.
Merge the two separate collation hashtables that were being maintained in
pg_locale.c, and be more wary of the possibility that we fail partway
through filling a cache entry.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
| -rw-r--r-- | src/include/catalog/pg_collation.h | 15 | ||||
| -rw-r--r-- | src/include/port.h | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index c10de537bec..e9659092198 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201103191 +#define CATALOG_VERSION_NO 201103201 #endif diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h index e90aa050f54..2ab0c504f65 100644 --- a/src/include/catalog/pg_collation.h +++ b/src/include/catalog/pg_collation.h @@ -58,8 +58,19 @@ typedef FormData_pg_collation *Form_pg_collation; #define Anum_pg_collation_collcollate 5 #define Anum_pg_collation_collctype 6 -DATA(insert OID = 100 ( default PGNSP PGUID -1 "" "" )); +/* ---------------- + * initial contents of pg_collation + * ---------------- + */ + +DATA(insert OID = 100 ( default PGNSP PGUID -1 "" "" )); DESCR("database's default collation"); -#define DEFAULT_COLLATION_OID 100 +#define DEFAULT_COLLATION_OID 100 +DATA(insert OID = 950 ( C PGNSP PGUID -1 "C" "C" )); +DESCR("standard C collation"); +#define C_COLLATION_OID 950 +DATA(insert OID = 951 ( POSIX PGNSP PGUID -1 "POSIX" "POSIX" )); +DESCR("standard POSIX collation"); +#define POSIX_COLLATION_OID 951 #endif /* PG_COLLATION_H */ diff --git a/src/include/port.h b/src/include/port.h index 9d08b392ce1..1116a92fd1f 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -155,6 +155,8 @@ extern int pg_strcasecmp(const char *s1, const char *s2); extern int pg_strncasecmp(const char *s1, const char *s2, size_t n); extern unsigned char pg_toupper(unsigned char ch); extern unsigned char pg_tolower(unsigned char ch); +extern unsigned char pg_ascii_toupper(unsigned char ch); +extern unsigned char pg_ascii_tolower(unsigned char ch); #ifdef USE_REPL_SNPRINTF |
