The mchar module provides additional data types
for compatibility with Microsoft SQL Server (MSSQL).
This module has been designed to improve 1C Enterprise support, most popular Russian CRM and ERP system.
It implements types MCHAR and MVARCHAR, which are bug-to-bug compatible with MSSQL CHAR and VARCHAR respectively. Additionaly, these types use libicu for comparation and case conversion, so their behavoir is identical across different operating system.
PostgresPro also includes citext extension which provides types similar to MCHAR. But this extension doesn't emulate MS-SQL behavoir concerning end-of-value whitespace.
Differences from PostgreSQL standard CHAR and VARCHAR are:
Case insensitive comparation
Handling of the whitespace at the end of string
These types are always stored as two-byte unicode value regradless of database encoding.
mchar — analog of the MSSQL char type
mvarchar — analog of the MSSQL varchar type
Defines length(str) function
Defines substr(str, pos[, length]) function
Defines || operator, which would be applied to concatenate any (mchar and mvarchar) arguments
Defines set of operators: <, <= =, >=, > for case-insensitive comparison (LibICU)
Defines set of operators: &<, &<=, &=, &>=, &> to case-sensitive comparison (LibICU)
Implicit cast between mchar and mvarchar types
B-tree and Hash-index support
The LIKE [ESCAPE] operator support
The SIMILAR TO [ESCAPE] operator support
The ~ operator (POSIX regexp) support
Index support for the LIKE operator
Oleg Bartunov <oleg@sai.msu.ru>
Teodor Sigaev <teodor@sigaev.ru>