Re: INSERTing rows from external file

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: INSERTing rows from external file
Дата
Msg-id 006201cc5c62$cac2dba0$604892e0$@yahoo.com
обсуждение исходный текст
Ответ на Re: INSERTing rows from external file  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: INSERTing rows from external file  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Rich Shepard
Sent: Tuesday, August 16, 2011 6:14 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] INSERTing rows from external file

On Tue, 16 Aug 2011, Chris Travers wrote:

> What kind of error?

Chris,

Here's the full statement for the last row:

psql:chem_too.sql:5517: ERROR:  invalid input syntax for type boolean: ""
LINE 1: ...NS','1996-11-21','Potassium','0.949999988','mg/L','','','','...
                                                              ^
   The column is NULLable and if there's no value a NULL should be entered.

> Do you get the same error by running psql interactively and typing \i
> filename.sql?

   Er, thanks for the pointer. I didn't read the psql man page first. Now
I'm using 'psql -f <filename> <database_name>' and getting the above error.

Thanks,

----------------------------------------------------------------------------
---------

Since the error references a specific row of data you should provide that as
well.

Your INSERT statement is syntactically incorrect; the error has nothing to
do with PSQL other than the fact that PSQL is reporting the error to you.

Odds are you are wrapping your Boolean input with single quotes and the
empty string is not valid input for a Boolean.  Because of the quotes the
system will not use NULL since the input data is not missing but instead it
has the empty-string as a value.

David J.




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

Предыдущее
От: Scott Ribe
Дата:
Сообщение: Re: INSERTing rows from external file
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: INSERTing rows from external file