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

From Richard Broersma
Subject Re: casting from integer to boolean
Date
Msg-id 396486430803261546v501d2cb5p1a5c756c786c511a@mail.gmail.com
Whole thread Raw
In response to Re: casting from integer to boolean  (Seb <spluque@gmail.com>)
List pgsql-general
On Wed, Mar 26, 2008 at 3:28 PM, Seb <spluque@gmail.com> wrote:
On Wed, 26 Mar 2008 15:11:47 -0700,
"Richard Broersma" <richard.broersma@gmail.com> wrote:

[...]

> INSERT INTO my_table (var_bool) VALUES ( CAST( 0 AS BOOLEAN )); or
> INSERT INTO my_table (var_bool) VALUES (0::BOOLEAN);


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.
 
My understanding is that a temporary staging table could be used to receive all of your data into postgresql.  Next, you can perform most of your data scrubbing within postgres with simple update statements.
Last, you and insert to the cleaned data with an insert+select statement with the appropriate casts.  this way you only need to do the casting in a single statement.
 

--
Regards,
Richard Broersma Jr.

pgsql-general by date:

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