Re: Strings with null characters produce exceptions when selectedor inserted. Attempts to select messages with null bytes produces "ERROR:insufficient data left in message". And inserting produces "ERROR: invalidbyte sequence for encoding \"UTF8\":

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: john(dot)lister(at)kickstone(dot)com
Cc: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, pgsql-jdbc-owner(at)postgresql(dot)org, Kris Jurka <books(at)ejurka(dot)com>, user2037(at)ymail(dot)com, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Strings with null characters produce exceptions when selectedor inserted. Attempts to select messages with null bytes produces "ERROR:insufficient data left in message". And inserting produces "ERROR: invalidbyte sequence for encoding \"UTF8\":
Date: 2009-06-04 12:21:04
Message-ID: 1244118064.5442.1.camel@huvostro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 2009-06-04 at 11:58 +0000, John Lister wrote:
> Apologies for top post using a blackberry. The binary mode should be able to cope fine as it passes the length before sending the data. Should be straightforward to add strings to patch.

PostgreSQL itself does not consider byte sequences with embedded nulls
to be strings, as lot of its string-handling expects C strings

Use bytea type for "strings" with embedded nulls.

--
Hannu Krosing http://www.2ndQuadrant.com
PostgreSQL Scalability and Availability
Services, Consulting and Training

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2009-06-04 13:22:56 Re: Strings with null characters produce exceptions when selectedor inserted. Attempts to select messages with null bytes produces "ERROR:insufficient data left in message". And inserting produces "ERROR: invalidbyte sequence for encoding \"UTF8\":
Previous Message John Lister 2009-06-04 11:58:26 Re: Strings with null characters produce exceptions when selectedor inserted. Attempts to select messages with null bytes produces "ERROR:insufficient data left in message". And inserting produces "ERROR: invalidbyte sequence for encoding \"UTF8\":