From: Kris Jurka <books@ejurka.com>
To: user2037@ymail.com
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Strings with null characters produce exceptions when selected or inserted. Attempts to select messages with null bytes produces "ERROR: insufficient data left in message". And inserting produces "ERROR: invalid byte sequence for encoding \"UTF8\": 0x00". Since a null character is a valid UTF code point why is it rejected by the JDBC driver? The attached test can work with Mysql and their JDBC driver.
Date: Wed, 3 Jun 2009 16:41:19 -0400 (EDT)
Message-ID: <alpine.BSO.2.00.0906031639270.2432@leary.csoft.net> (raw)
In-Reply-To: <626803.19538.qm@web59808.mail.ac4.yahoo.com>
References: <626803.19538.qm@web59808.mail.ac4.yahoo.com>
On Wed, 3 Jun 2009, user2037@ymail.com wrote:
> Strings with null characters produce exceptions when selected or
> inserted. Attempts to select messages with null bytes produces "ERROR:
> insufficient data left in message". And inserting produces "ERROR:
> invalid byte sequence for encoding \"UTF8\": 0x00".
>
> Since a null character is a valid UTF code point why is it rejected by
> the JDBC driver?
Because the server can't handle it. The server is written in C and tracks
all textual data as C strings which are null terminated. It cannot handle
intermediate null bytes, so the driver is just providing that message as
early as possible to you.
Kris Jurka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: books@ejurka.com, user2037@ymail.com
Subject: Re: Strings with null characters produce exceptions when selected or inserted. Attempts to select messages with null bytes produces "ERROR: insufficient data left in message". And inserting produces "ERROR: invalid byte sequence for encoding \"UTF8\": 0x00". Since a null character is a valid UTF code point why is it rejected by the JDBC driver? The attached test can work with Mysql and their JDBC driver.
In-Reply-To: <alpine.BSO.2.00.0906031639270.2432@leary.csoft.net>
References: <626803.19538.qm@web59808.mail.ac4.yahoo.com> <alpine.BSO.2.00.0906031639270.2432@leary.csoft.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox