"invalid input syntax for type bytea"

From: Alan Millington <admillington(at)yahoo(dot)co(dot)uk>
To: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: "invalid input syntax for type bytea"
Date: 2011-08-31 16:02:59
Message-ID: 1314806579.49922.YahooMailClassic@web25403.mail.ukl.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am running Postgres 8.4.1 on Windows XP Professional Service Pack 3. My database is UTF8. My program code is written in Python, and to interface to Postgres I use mxODBC 3.0 and the PostgreSQL Unicode driver PSQLODBCW.DLL version 8.01.02.00 dated 31/01/2006.
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.)
If I have counted right, character 75 is the '7' in '\\175', which looks to be a valid octal value.
The statement as shown in the log is generated by mxODBC, not by me, so if there is something wrong with it I shall have to take the matter up with eGenix. Before I do so it would be useful to know what is wrong with the statement.
I had to tweak my own code when I upgraded from Postgres 8.1 to 8.4, but since then I have inserted 5092 rows with an average binary data length of 40,000 bytes. This is the only insert that has failed.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2011-08-31 16:16:03 Re: [GENERAL] pg_upgrade problem
Previous Message Scott Ribe 2011-08-31 15:57:48 Re: out of memory - no sort