Re: Access import

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Access import
Дата
Msg-id 20478.967661593@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Access import  ("Marc Zandvliet" <marc@auroraworks.com>)
Список pgsql-novice
"Marc Zandvliet" <marc@auroraworks.com> writes:
> I'm trying to import a small Access db into a linux-based psql database via
> a delimited text file. I've set up the table to reflect the fields etc. The
> last field of the database is boolean which Access exports as 0 or 1. When I
> try to import I get this:

> mydb=> copy new_table from '/tmp/exported.txt' using delimiters '|';
> 'RROR:  Bad boolean external representation '1
> mydb=>

> I've checked the source text file and the last field doesn't have the '
> before the 1.

Looks to me like your source text file is probably stored with DOS
newlines, ie CR/LF.  COPY is expecting Unix newlines (LF only) and
treats the CR characters as part of the data.  The boolean input
converter doesn't like garbage characters in its input data, and when
it complains, the CR is included in the error message, causing the
overstrike behavior you show.  The message is really

ERROR:  Bad boolean external representation '1<CR>'

Convert the file to Unix newline convention and you should be OK...

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 7.0.2 regressions testing on Sparc running 2.5.1
Следующее
От: radix@ihug.com.au
Дата:
Сообщение: sql with postgresql beginner