CHARACTER_LENGTH
The CHARACTER_LENGTH() function:.
	The CHARACTER_LENGTH() function:
- 
Returns the string length in UTF-8 characters for CHAR and VARCHAR columns 
- 
Returns the string length in bytes (octets) for BINARY and VARBINARY columns 
- 
Strips the padding from CHAR expressions but not from VARCHAR expressions 
- 
Is identical to LENGTH() for CHAR and VARCHAR. For binary types, CHARACTER_LENGTH() is identical to OCTET_LENGTH(). 
Behavior type
Immutable if USING OCTETS, stable otherwise.
Syntax
[ CHAR_LENGTH | CHARACTER_LENGTH ] ( expression ... [ USING { CHARACTERS | OCTETS } ] )
Arguments
- expression
- (CHAR or VARCHAR) is the string to measure
- USING CHARACTERS | OCTETS
- Determines whether the character length is expressed in characters (the default) or octets.
Examples
=> SELECT CHAR_LENGTH('1234  '::CHAR(10) USING OCTETS);
 octet_length
--------------
            4
(1 row)
=> SELECT CHAR_LENGTH('1234  '::VARCHAR(10));
 char_length
-------------
           6
(1 row)
=> SELECT CHAR_LENGTH(NULL::CHAR(10)) IS NULL;
 ?column?
----------
 t
(1 row)