Re: [GENERAL] Importing SQLite database

Поиск
Список
Период
Сортировка
От Steve Atkins
Тема Re: [GENERAL] Importing SQLite database
Дата
Msg-id 86F132FB-2DD9-452C-A702-2C1551F4941E@blighty.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Importing SQLite database  (Igor Korot <ikorot01@gmail.com>)
Список pgsql-general
> On Dec 10, 2016, at 11:32 AM, Igor Korot <ikorot01@gmail.com> wrote:
>
> Hi, guys,
> I'm working thru my script and I hit a following issue:
>
> In the script I have a following command:
>
> CREATE TABLE playersinleague(id integer, playerid integer, ishitter
> char, age integer, value decimal, currvalue decimal, draft boolean,
> isnew char(1), current_rank integer, original_rank integer, deleted
> integer, teamid integer, notes varchar(125), PRIMARY KEY(id,playerid),
> foreign key(id) references leagues(id), foreign key(playerid)
> references players(playerid),foreign key(teamid) references
> teams(teamid));
>
> Now this command finished successfully, however trying to insert a
> record with following command:
>
> INSERT INTO  playersinleague  VALUES(1,1,'1',27,42.0,42.0,0,'0',1,1,0,23,NULL);
>
> gives following error:
>
> psql:/Users/igorkorot/draft.schema:10578: ERROR:  column "draft" is of
> type boolean but expression is of type integer
>
> Looking at https://www.postgresql.org/docs/9.5/static/datatype-numeric.html,
> I don't see a 'boolean' as supported data type.

Booleans aren't numeric.

https://www.postgresql.org/docs/9.5/static/datatype-boolean.html

Boolean will take a range of formats, including '0' - an untyped literal
"0". But it won't take an integer, which is what an unquoted 0 is.

You'll need to modify your insert statement slightly to use a valid boolean
value for that field ("true" or "false" are idiomatic).

Cheers,
  Steve



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: [GENERAL] Importing SQLite database
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [GENERAL] Importing SQLite database