Re: casting from integer to boolean - Mailing list pgsql-general

From Tom Lane
Subject Re: casting from integer to boolean
Date
Msg-id 14939.1206572153@sss.pgh.pa.us
Whole thread Raw
In response to Re: casting from integer to boolean  ("Adam Rich" <adam.r@sbcglobal.net>)
List 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 by date:

Previous
From: Seb
Date:
Subject: Re: casting from integer to boolean
Next
From: Seb
Date:
Subject: Re: casting from integer to boolean