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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Getting "insufficient data left in message" on copy with binary
Дата
Msg-id 10265.1252195302@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Getting "insufficient data left in message" on copy with binary  (Gordon Shannon <gordo169@gmail.com>)
Список pgsql-general
Gordon Shannon <gordo169@gmail.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Chris Barnes
Дата:
Сообщение: Re: PG connections going to 'waiting'
Следующее
От: Josef Wolf
Дата:
Сообщение: Re: pg_ctl with unix domain socket?