Michael Parker <parkerm@pobox.com> writes:
> The next hurdle, and I've just posted to the DBD::Pg list, is
> escaping/quoting the token strings.
If you're trying to write a bytea[] literal, I think the most reliable
way to write the individual bytes is
    \\\\nnn
where nnn is *octal*.  The idea here is:
    * string literal parser takes off one level of backslashing,
      leaving \\nnn
    * array input parser takes off another level, leaving \nnn
    * bytea input parser knows about backslashed octal values
Note it has to be 3 octal digits every time, no abbreviations.
            regards, tom lane