diff --git a/doc/src/sgml/func/func-binarystring.sgml b/doc/src/sgml/func/func-binarystring.sgml
index 0aaf9bc68f1..dc6b7e57ea7 100644
--- a/doc/src/sgml/func/func-binarystring.sgml
+++ b/doc/src/sgml/func/func-binarystring.sgml
@@ -778,18 +778,26 @@
RFC 4648 Section 7. It uses the extended hex alphabet
(0-9 and
- A-V) which preserves the lexicographical
- sort order of the encoded data. The encode function
+ A-V) which preserves the sort order of
+ the encoded data when compared byte-wise. The encode function
produces output padded with '=', while decode
accepts both padded and unpadded input. Decoding is case-insensitive and ignores
whitespace characters.
- This format is useful for encoding UUIDs in a compact, sortable format:
+ This format is useful for encoding UUIDs in a compact, byte-wise sortable format:
rtrim(encode(uuid_value::bytea, 'base32hex'), '=')
produces a 26-character string compared to the standard 36-character
UUID representation.
+
+
+ To maintain the lexicographical sort order of the encoded data,
+ ensure that the text is sorted using the C collation
+ (e.g., using COLLATE "C"). Natural language
+ collations may sort characters differently and break the ordering.
+
+