PostgreSQL provides us with a handful of string functions that return the length of a given string.
But the result between these functions can be different, depending on which function we use. That’s because the “length” can be different, depending on what we’re measuring. Are we talking about the number of characters in the string? Or the number of bytes in the string? Or perhaps we want to know the number of bits in the string.
The function we use will depend on which of the above we’re trying to measure. Below are five functions that cater for each of the above questions.
Continue reading