postgres=#postgres=# -- substring(string [from int] [for int]) bytea Extract substringpostgres=# select substring('Th\\000omas'::bytea from 2 for 3); substring----------- h\000o(1 row)postgres=#