Re: casting from integer to boolean

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: casting from integer to boolean
Дата
Msg-id 14939.1206572153@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: casting from integer to boolean  ("Adam Rich" <adam.r@sbcglobal.net>)
Список pgsql-general
"Adam Rich" <adam.r@sbcglobal.net> writes:
>> Thanks Richard.  Is there a way to do it without changing the INSERT
>> command?  As I mentioned, there are many more columns of different
>> types, so finding and replacing the VALUES would be very difficult.

> Can you import the data into a holding table (with columns defined
> as integer) first, and then use a SQL statement to insert from there
> into the final destination table (casting in the process) ?

If you're feeling desperate you could change the built-in integer
to boolean cast to be AS ASSIGNMENT rather than explicit-only.
Not sure this is a good idea --- one big problem with it is that
the change wouldn't be preserved by pg_dump, so if this is an
ongoing requirement rather than a one-time conversion effort that
would probably cause problems later.

            regards, tom lane

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

Предыдущее
От: Seb
Дата:
Сообщение: Re: casting from integer to boolean
Следующее
От: Seb
Дата:
Сообщение: Re: casting from integer to boolean