Re: pg_dump and boolean format

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: pg_dump and boolean format
Дата
Msg-id 13572A4A-2495-404C-BC3F-95DB37705A9F@seespotcode.net
обсуждение исходный текст
Ответ на pg_dump and boolean format  (Scott Frankel <frankel@circlesfx.com>)
Ответы Re: pg_dump and boolean format  (Scott Frankel <frankel@circlesfx.com>)
Список pgsql-general
On Aug 11, 2010, at 13:00 , Scott Frankel wrote:

> The pg docs say that booleans can be stored as 't', 'true', 'y', 'yes', or '1'.

Booleans are not "stored" as those literals: those are only acceptable literals (i.e., string representations) for
booleanvalues. 

> I'm using pg_dump to create an SQL script for importing into another database.  This will happen automatically and
repeatedly. Unfortunately, the other database (sqlite) is limited to only integer representation of booleans:  0 or 1. 

One option is to use COPY to export the data in a format you like. For example: COPY (SELECT CAST(boolean_column AS
INT)FROM my_table) TO STDOUT. Then write a script which reads the exported data files and loads them into your sqlite
database.COPY WITH CSV would likely be helpful as well. 

Michael Glaesemann
grzm seespotcode net




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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Finding last checkpoint time
Следующее
От: Michael C Rosenstein
Дата:
Сообщение: PG-friendly CASE/modeling tool?