Which Index for WHERE UPPER("my_col"::text) LIKE "FOO" search on bytea
You could create an immutable function which changes the \000 null characters (plus any other characters you consider to be binary) to spaces, then create a trigram index on that function over the column. There might be such a function built in, but if so I don't know of it.