Re: Getting "insufficient data left in message" on copy with binary

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gordon Shannon <gordo169(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting "insufficient data left in message" on copy with binary
Date: 2009-09-06 00:01:42
Message-ID: 10265.1252195302@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Gordon Shannon <gordo169(at)gmail(dot)com> writes:
> Got it. The problem was a combination of 2 mis-matched data types.
> ...
> So, my fault, and the fix is obvious. But it does seem like a less than
> ideal error message.

The binary format is sufficiently non-redundant that it's hard for the
code to know just what is wrong. In this case the first data column
was slurping up bits that belonged to the second column, leaving not
enough data for the second column when it came time to read that.

> Also, maybe a sentence like this would be helpful on the COPY page: "Be
> careful that the data types match from 'copy to' to 'copy from'. There is
> no implicit conversion done in binary mode..." or some such?

I added this text:

***************
*** 300,305 ****
--- 300,309 ----
somewhat faster than the normal text mode, but a binary-format
file is less portable across machine architectures and
<productname>PostgreSQL</productname> versions.
+ Also, the binary format is very data type specific; for example
+ it will not work to output binary data from a <type>smallint</> column
+ and read it into an <type>integer</> column, even though that would work
+ fine in text format.
</para>

<para>

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josef Wolf 2009-09-06 09:47:08 Re: pg_ctl with unix domain socket?
Previous Message Chris Barnes 2009-09-05 23:41:42 Re: PG connections going to 'waiting'