Alan Millington <admillington@xxxxxxxxxxx> writes: > I recently hit an error when trying to insert into a bytea column. The following is the first part of what appears in the Postgres log: > 2011-08-25 14:42:40 BST HINT: Use the escape string syntax for backslashes, e.g., E'\\'.2011-08-25 14:42:40 BST ERROR: invalid input syntax for type bytea at character 752011-08-25 14:42:40 BST STATEMENT: insert into FAMILY_DATA (family_id, seq_num, family_pod) values (177, 20, > '\\200\\002\\135q\\001\\050cperson\\012Person\\012q\\002\\051\\201q\\003\\175q\\004\\050U\\006\\137namesq\\005cperson\\012\\137Names\\012q\\006\\051\\201q\\007cperson\\012\\137Name\\012q\\010\\051\\201q\\011\\050\\135q\\012X\\003\\000\\000\\00017\\052q\\013a\\135q\\014X\\002\\000\\000\\000ABq\\015ae\\175q\\016U\\006parentq\\017h\\007sba\\175q\\020U\\006personq\\021h\\003sbU\\021nationality\\137eventq\\022cperson\\012Dictof\\137Nationality\\137Event\\012q\\023\\051\\201q\\024X\\004\\000\\000\\000UKBSq\\025\\175q\\026\\051cperson\\012Listof\\137Nationality\\137Event\\012q\\027\\051\\201q\\030\\050cperson\\012Nationality\\137Event\\012q\\031\\051\\201q\\032\\175q\\033\\050U\\015contra\\137eventsq\\034\\051U\\006parentq\\035h\\030U\\004bvosq\\036c\\137\\137builtin\\137\\137\\012set\\012q\\037\\135q U\\002ATq\\041a\\205Rq\\042U\\007cfflagsq\\043\\051U\\006effectq\\044U\\001AU\\005cinfoq\\045ccinfo\\012BCInfo > (I omit the rest, but there is a close quote and a close parenthesis at the end.) Well, the part you showed us is perfectly valid bytea data, so the problem is somewhere in what you omitted. > If I have counted right, character 75 is the '7' in '\\175', which looks to be a valid octal value. Unfortunately, that number is just a pointer to the start of the bytea literal within the statement, so it's not very helpful here :-(. What you need to look for is a backslash that's not followed by either a second backslash or octal digits. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general