Search Postgresql Archives

Re: casting from integer to boolean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 26, 2008 at 3:28 PM, Seb <spluque@xxxxxxxxx> wrote:
On Wed, 26 Mar 2008 15:11:47 -0700,
"Richard Broersma" <richard.broersma@xxxxxxxxx> 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.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux