From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net> |
Cc: | "'Seb'" <spluque(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: casting from integer to boolean |
Date: | 2008-03-26 22:55:53 |
Message-ID: | 14939.1206572153@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Adam Rich" <adam(dot)r(at)sbcglobal(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Seb | 2008-03-26 23:03:06 | Re: casting from integer to boolean |
Previous Message | Seb | 2008-03-26 22:54:25 | Re: casting from integer to boolean |