postgres=#
postgres=# -- btrim(string bytea, bytes bytea)
postgres=# -- Remove the longest string consisting only of bytes in bytes from the start and
postgres=# -- end of string
postgres=#
postgres=# select btrim('\\000trim\\000'::bytea, '\\000'::bytea);
btrim
-------
trim
(1 row)
postgres=#
postgres=#